[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 Walter Bright changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED --- Comment #11 from Walter Bright 2009-10-06 02:14:23 PDT --- Fixed dmd 1.048 and 2.033 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 Don changed: What|Removed |Added Keywords||patch OS/Version|Linux |All --- Comment #10 from Don 2009-09-22 01:07:54 PDT --- The root cause is that all kinds of nonsense is allowed in struct casts. Explicit struct casts only make sense when the source and destination are of the same size. Patch against DMD 2.032. Index: cast.c === --- cast.c(revision 196) +++ cast.c(working copy) @@ -822,6 +822,15 @@ return e; } } +// Struct casts are possible only when the sizes match +if (typeb->ty==Tstruct || tb->ty==Tstruct) { +size_t fromsize = tb->size(loc); +size_t tosize = typeb->size(loc); +if (fromsize !=tosize) { +error("Cannot cast from %s to %s", type->toChars(), t->toChars()); +return this; +} +} e = new CastExp(loc, e, tb); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 --- Comment #9 from Jarrett Billingsley 2009-09-03 09:48:19 PDT --- *** Issue 3287 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 --- Comment #8 from Don 2009-08-08 22:21:44 PDT --- There's a patch for the original bug in bug 2702. It's unrelated to the ICE. (It's really annoying when new bugs are reported in the comments for existing bugs, it's not clear what to do with them). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 --- Comment #6 from Don 2009-08-07 01:28:58 PDT --- There are two completely different bugs in this report. One is the implicit conversion one, which is a bad code generation bug. The ICE is actually a quite different bug. Here's a test case which doesn't involve the initialisation bug. struct Small { uint x; } struct Large { uint x, y, z; } Small foo() { return Small(); } void main() { Large l; Small s; l = cast(Large)foo(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 Don changed: What|Removed |Added CC||ma...@pochta.ru --- Comment #7 from Don 2009-08-07 01:29:07 PDT --- *** Issue 3036 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 2469] ICE(cod1.c) arbitrary struct accepted as struct initializer
http://d.puremagic.com/issues/show_bug.cgi?id=2469 Jarrett Billingsley changed: What|Removed |Added CC||rayerd@gmail.com --- Comment #5 from Jarrett Billingsley 2009-07-30 08:42:40 PDT --- *** Issue 3216 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---