Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 13, 2009 [Issue 3173] New: assert on wrong code (double to long to int conversion) | ||||
---|---|---|---|---|
| ||||
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: ------- |
August 31, 2009 [Issue 3173] ICE(mtype.c) on wrong code (double to long to int conversion) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ace17@free.fr | http://d.puremagic.com/issues/show_bug.cgi?id=3173 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |regression --- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-08-31 08:16:52 PDT --- 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: ------- |
September 01, 2009 [Issue 3173] ICE(mtype.c) on wrong code (double to long to int conversion) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ace17@free.fr | 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 --- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-08-31 23:56:38 PDT --- 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: ------- |
September 01, 2009 [Issue 3173] ICE(mtype.c) on wrong code (double to long to int conversion) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ace17@free.fr | http://d.puremagic.com/issues/show_bug.cgi?id=3173 --- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-09-01 04:25:11 PDT --- 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: ------- |
October 06, 2009 [Issue 3173] ICE(mtype.c) on wrong code (double to long to int conversion) | ||||
---|---|---|---|---|
| ||||
Posted in reply to ace17@free.fr | 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 --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-10-06 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: ------- |
Copyright © 1999-2021 by the D Language Foundation