Thread overview
[Issue 1787] New: Compiler segfaults on circular references.
Jan 15, 2008
d-bugmail
Sep 09, 2008
d-bugmail
Apr 18, 2009
d-bugmail
May 15, 2009
Don
Aug 13, 2009
Don
Oct 13, 2009
Walter Bright
January 15, 2008
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;


-- 

September 09, 2008
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




------- Comment #1 from smjg@iname.com  2008-09-09 16:14 -------
Related to issue 713?

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


-- 

April 18, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1787


clugdbug@yahoo.com.au changed:

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




------- Comment #2 from clugdbug@yahoo.com.au  2009-04-18 02:47 -------
(In reply to comment #1)
> 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;


-- 

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


Don <clugdbug@yahoo.com.au> changed:

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




--- Comment #3 from Don <clugdbug@yahoo.com.au>  2009-05-15 00:17:39 PDT ---
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: -------
August 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1787


Don <clugdbug@yahoo.com.au> changed:

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




--- Comment #4 from Don <clugdbug@yahoo.com.au>  2009-08-13 00:22:15 PDT ---

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: -------
October 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1787


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2009-10-13 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: -------