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