www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1787] New: Compiler segfaults on circular references.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1787

           Summary: Compiler segfaults on circular references.
           Product: D
           Version: 1.024
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aziz.kerim gmail.com


// Code snippets which kill dmd.
struct A
{ const a = B.b; }
struct B
{ const b = A.a; }

struct C
{
  const x = C.x;
}

// Some examples which don't segfault. The compiler reports errors as it
should.
const x = x;
const a = b;
const b = a;


-- 
Jan 15 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1787


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |ice-on-invalid-code





Related to issue 713?

WFM 1.035 Windows.  Has it gone away, or is it platform parity?


-- 
Sep 09 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1787


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
         OS/Version|Linux                       |All






 Related to issue 713?
 
 WFM 1.035 Windows.  Has it gone away, or is it platform parity?
 
The first example now works, but the second one segfaults: struct C { const x = C.x; } Segfaults on DMD2.028 and 1.042 Windows. I've patched it so that it displays: bug.d(2): Error: variable bug.C.x cannot infer type Patch against DMD2.028 in void VarDeclaration::semantic(Scope *sc). Index: declaration.c =================================================================== --- declaration.c (revision 22) +++ declaration.c (working copy) -688,6 +688,7 if (!type) { inuse++; type = init->inferType(sc); + if (!type) { error("cannot infer type"); return; } inuse--; inferred = 1; --
Apr 18 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1787


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au





Was fixed in DMD2.030, still segfaults in DMD1.045.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1787


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch






This patch isn't great, but since it's already got a proper fix in D2, it might
be OK.

Index: mtype.c
===================================================================
--- mtype.c    (revision 192)
+++ mtype.c    (working copy)
   -4313,6 +4313,11   
     s = s->toAlias();

     v = s->isVarDeclaration();
+    if (v && v->isConst() && !v->type) {
+        // BUG 1787. TODO: This isn't the best place for this error message,
but it prevents a segfault
+        error(e->loc, "Cannot infer type of %s", v->toChars());
+        return e; 
+    }
     if (v && v->isConst() && v->type->toBasetype()->ty != Tsarray)
     {    ExpInitializer *ei = v->getExpInitializer();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1787


Walter Bright <bugzilla digitalmars.com> changed:

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



13:50:16 PDT ---
Fixed dmd 1.049

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2009