digitalmars.D.bugs - [Issue 3173] New: assert on wrong code (double to long to int conversion)
- d-bugmail puremagic.com (23/23) Jul 13 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3173
- d-bugmail puremagic.com (10/10) Aug 31 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3173
- d-bugmail puremagic.com (41/41) Aug 31 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3173
- d-bugmail puremagic.com (19/19) Sep 01 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3173
- d-bugmail puremagic.com (12/12) Oct 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3173
http://d.puremagic.com/issues/show_bug.cgi?id=3173 Summary: assert on wrong code (double to long to int conversion) Product: D Version: 2.031 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: ace17 free.fr void f1() { double d; int c = cast(long)(d); } produces : dmd: mtype.c:1554: uinteger_t Type::sizemask(): Assertion `0' failed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 13 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3173 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |regression This is a regression. It worked in 2.022. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 31 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3173 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch OS/Version|Linux |All Cause: default case for getIntRange() assumes it's an integer, which isn't true if there's casting. Solution: if not an integer, assume it could contain anything. PATCH: cast.c, line 1902 (in Walter's private beta of DMD2.032): IntRange Expression::getIntRange() { IntRange ir; ir.imin = 0; if (type->isintegral()) ir.imax = type->sizemask(); else ir.imax = 0xFFFFFFFFFFFFFFFFULL; // assume the worst return ir; } =========== TEST CASES FOR TEST SUITE =========== struct S3173{ double z; } int bug3173(int x) { return x; } S3173 s3173; double e3173 = 4; const double d3173 = 4; // invalid, but should not ICE static assert(!is(typeof(bug3173(cast(long)e3173)))); static assert(!is(typeof(bug3173(cast(long)s3173)))); static assert(!is(typeof(bug3173(cast(long)3.256679e30)))); // And two valid cases: static assert(is(typeof(bug3173(cast(long)d3173)))); static assert(is(typeof(bug3173(cast(long)3.256679e4)))); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 31 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3173 Patch was incomplete, fails for the test case below. Need to also add this code to the end of CastExp::getIntRange() + if (type->isintegral()) { ir.imin &= type->sizemask(); ir.imax &= type->sizemask(); + } return ir; } ==== Test case: ubyte b = 6; short c5 = cast(int)(b + 6.1); ==== This is arguably an ice-on-valid-code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 01 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3173 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 02:21:38 PDT --- Fixed dmd 2.033 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2009