www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1485] New: Reference to enum member in circular import crashes DMD

reply d-bugmail puremagic.com writes:

           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 {
----- 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:
  Application Timestamp:        00000000
  Fault Module Name:    dmd.exe
  Fault Module Version:
  Fault Module Timestamp:       00000000
  Exception Code:       c0000005
  Exception Offset:     00005f00
  OS Version:   6.0.6000.
  Locale ID:    2057
  Additional Information 1:     738d
  Additional Information 2:     4006521eea9aecc7f677124b6582e676
  Additional Information 3:     cbc2
  Additional Information 4:     94674fc8932fc2ceeab371c294834e7e

Sep 07 2007
next sibling parent d-bugmail puremagic.com writes:

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

Sep 26 2007
prev sibling parent d-bugmail puremagic.com writes:

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

May 02 2009