Bug 13021 – Constructing union with floating type and then accessing its field in one expression causes ICE

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-02T14:49:00Z
Last change time
2014-08-22T08:04:14Z
Keywords
ice, pull
Assigned to
nobody
Creator
sinkuupump

Comments

Comment #0 by sinkuupump — 2014-07-02T14:49:14Z
When the union is declared like: the first is a floating point type, the followings are not floatings, but their sizes are same as first. Code: union Fail { float a; int b; } union Fail2 { double a; long b; } union Fail3 { real a; struct B { long b1, b2; } // ICE happens only if B.sizeof == real.sizeof B b; } union Fail4 { real a; long[2] b; // ditto } void main() { auto f = Fail(1.0); auto ok = f.b; // these messages are generated by DMD v2.066-devel-4272838 auto fail = Fail(1.0).b; // Internal error: e2ir.c 1162 // auto fail2 = Fail2(1.0).b; // Internal error: e2ir.c 1162 // auto fail3 = Fail3(1.0).b; // Internal error: e2ir.c 1162 // auto fail4 = Fail4(1.0).b; // Internal error: backend/el.c 2904 } Note: On DMD2.065 and DMD2.064.2, "Fail4" doesn't cause ICE.
Comment #1 by growlercab — 2014-07-06T02:05:25Z
I'm also getting this trying to build msgpack.d with 2.066. I am pretty sure this is a regression because msgpack built OK pre-2.066.
Comment #2 by sinkuupump — 2014-07-06T04:47:50Z
I found this bug with building msgpack.d with latest dmd, too. msgpack.d compiles successfully on pre2.066 of dmd, but this code causes ICE on pre2.066. Please see this paste(this is 2.065): http://dpaste.dzfl.pl/5a1e160b5f59 I also tested with even earlier than 2.060, but ICE happens. % dmd | head -n1 DMD64 D Compiler v2.055 % dmd -run ice.d 1 int 0x7f833503c380 int 0x7f833503c380 ty = 18, tym = a Internal error: e2ir.c 1319
Comment #3 by k.hara.pg — 2014-07-06T13:44:41Z
Comment #4 by github-bugzilla — 2014-07-07T16:13:55Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3b00c2895d6b649be3852a21f256e03bf124e074 fix Issue 13021 - Constructing union with floating type and then accessing its field in one expression causes ICE https://github.com/D-Programming-Language/dmd/commit/10f3bf1bf81279511a3f41faaa34deb6c62ae42f Merge pull request #3723 from 9rnsr/fix13021 Issue 13021 - Constructing union with floating type and then accessing its field in one expression causes ICE
Comment #5 by github-bugzilla — 2014-07-08T01:25:11Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f9a254cd33c90872037bb616ff14246e9c27d9dc Merge pull request #3723 from 9rnsr/fix13021 Issue 13021 - Constructing union with floating type and then accessing its field in one expression causes ICE
Comment #6 by github-bugzilla — 2014-08-22T08:04:14Z