Thread overview
[Issue 1485] New: Reference to enum member in circular import crashes DMD
Sep 07, 2007
d-bugmail
Sep 26, 2007
d-bugmail
May 02, 2009
d-bugmail
September 07, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1485

           Summary: Reference to enum member in circular import crashes DMD
           Product: D
           Version: 1.021
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: smjg@iname.com


----- 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
----------


-- 

September 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1485


kamm-removethis@incasoftware.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All
            Version|1.021                       |1.020




------- Comment #1 from kamm-removethis@incasoftware.de  2007-09-26 02:36 -------
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


-- 

May 02, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1485


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #2 from bugzilla@digitalmars.com  2009-05-02 06:44 -------
works on dmd 2.029 and 1.042


--