Bug 1485 – Reference to enum member in circular import crashes DMD
Status
RESOLVED
Resolution
WORKSFORME
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-09-07T18:38:00Z
Last change time
2014-02-16T15:23:37Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
smjg
Comments
Comment #0 by smjg — 2007-09-07T18:38:59Z
----- regression1021_2a.d -----
import regression1021_2b;
enum DAY {
SUN, MON, TUE, WED, THU, FRI, SAT
}
----- regression1021_2b.d -----
import regression1021_2a;
const char[][7] DAY_NAME = [
DAY.SUN: "sunday", "monday", "tuesday", "wednesday",
"thursday", "friday", "saturday"
];
----------
dmd regression1021_2b.d
dmd regression1021_2b.d regression1021_2a.d
- compile without error
dmd regression1021_2a.d
dmd regression1021_2a.d regression1021_2b.d
- crash
Error information as reported by Windows Vista:
----------
Problem Event Name: APPCRASH
Application Name: dmd.exe
Application Version: 0.0.0.0
Application Timestamp: 00000000
Fault Module Name: dmd.exe
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Code: c0000005
Exception Offset: 00005f00
OS Version: 6.0.6000.2.0.0.768.3
Locale ID: 2057
Additional Information 1: 738d
Additional Information 2: 4006521eea9aecc7f677124b6582e676
Additional Information 3: cbc2
Additional Information 4: 94674fc8932fc2ceeab371c294834e7e
----------
Comment #1 by kamm-removethis — 2007-09-26T02:36:02Z
This hard to diagnose segfault has recently caused major headache in a C++ to D porting project. After some experimenting it became clear that something connected with circular imports had to be the cause, but we never expected the enum to be the culprit.
Our minimal testcase looks like this:
--- enumbug1.d ---
import enumbug2;
enum e { val }
--- enumbug2.d ---
import enumbug1;
const int i = e.val;
dmd -c enumbug1.d -> segmentation fault
dmd -c enumbug2.d -> ok