Bug 16402 – ICE when reinterpreting a function as a long[2]
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-18T14:14:48Z
Last change time
2020-03-21T03:56:32Z
Keywords
ice, ice-on-valid-code
Assigned to
No Owner
Creator
Cauterite
Comments
Comment #0 by cauterite — 2016-08-18T14:14:48Z
( https://dpaste.dzfl.pl/01922868e611 )
void f() {};
void main() {
auto X = *cast(long[2]*) &f;
};
// Internal error: backend\cod2.c 3971
The `2` in `long[2]` can be any number > 1.
On x86-32 the same bug is also triggered by `int[2]` and `uint[2]`.
This works fine:
auto Ptr = cast(long[2]*) &f;
auto X = *Ptr;
It can also be triggered with the enclosing function:
void main() {
auto X = *cast(long[2]*) &main; // Internal error …
};