www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3803] New: compiler segfaults

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

           Summary: compiler segfaults
           Product: D
           Version: 1.056
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: fawzi gmx.ch



The following (incorrect) code segfaults the compiler

I suppose that it is connected with something segfault on correct code of


{{{
struct S {
    int x;

    template T(int val) {
        const P T = { val }; // the P here is an error it should be S
    }
}

template V(R,int val){
    const R V=R.T!(val);
}

const S x = V!(S,0);
}}}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3803


Don <clugdbug yahoo.com.au> changed:

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



This was a regression since 1.053. Suprisingly, it is fixed by bug 3767, in svn
367.

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




I have tried to find the problem using ldc (that shares the problem), also
using the larger correct code that shows the problem (stacktraces are similar).

The problem seems to be located in expression.c:5048

        Dsymbol *s = ti->inst->toAlias();

ti->inst == NULL, so that the compiler segfaults.
In the correct code I am not sure if inst is NULL because a single pass cannot
instantiate the template, or because it is in an is expression.
In any case simply catching this case and return new ErrorExp(); doesn't seem
to be enough (then I have other problems).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3803




a clean compile, and my fix doesn't look to bad.

klickverbot even tested dstess, and it did not make anything worse.

It might not be the correct fix, but still improves things.
{{{
diff -r 9cc791423e20 dmd/expression.c
--- a/dmd/expression.c    Thu Feb 25 17:12:54 2010 -0700
+++ b/dmd/expression.c    Sun Feb 28 23:59:36 2010 +0100
 -5946,6 +5946,7   
     eleft = dte->e1;
     ti->tempdecl = td;
     ti->semantic(sc);
+        if (ti->inst == NULL) return new ErrorExp();
     Dsymbol *s = ti->inst->toAlias();
     Declaration *v = s->isDeclaration();
     if (v)
}}}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3803


Kosmonaut <Kosmonaut tempinbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Kosmonaut tempinbox.com



---
SVN commit: http://www.dsource.org/projects/dmd/changeset/404

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 02 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3803


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



22:23:57 PST ---
Fixed dmd 1.057 and 2.041

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2010