Bug 9710 – Pointer enums crash dmd

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2013-03-13T13:01:00Z
Last change time
2013-07-28T16:52:31Z
Keywords
ice, pull
Assigned to
nobody
Creator
NCrashed

Comments

Comment #0 by NCrashed — 2013-03-13T13:01:08Z
Reveals while porting old C library, below code crashes dmd v2.062 without any error reported: long gi; enum gi0 = ((cast(int *)&gi)[0]); enum gi1 = ((cast(int *)&gi)[1]); void main() { }
Comment #1 by NCrashed — 2013-03-13T13:05:45Z
Appears only at Windows.
Comment #2 by bearophile_hugs — 2013-03-13T13:08:00Z
If you port C code them maybe you want to write: __gshared long gi;
Comment #3 by NCrashed — 2013-03-14T07:08:09Z
(In reply to comment #2) > If you port C code them maybe you want to write: > > > __gshared long gi; It is doesn't matter, this code doesn't have sence in D, enums are calculated in compile time, but preprocessor just pastes code in C. When porting C code, it is very difficult to find such error due dmd just crashes without any message.
Comment #4 by henning — 2013-07-28T12:28:25Z
Comment #5 by github-bugzilla — 2013-07-28T16:52:19Z