www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3401] New: Compiler crash on invariant + method overload

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

           Summary: Compiler crash on invariant + method overload
           Product: D
           Version: 1.048
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: moritzwarning web.de



PDT ---
dmd 1.049 and svn r102 crash on this code.

class A
{
        invariant
        {
              //  assert (true);
        }

        void fill ()
        {
        }
}


class B : A
{
    void fill ()
        {
        }
}

Program received signal SIGSEGV, Segmentation fault.
VarExp (this=0x96f20c0, loc={filename = 0x96daa88 "tango.io.Buffer.d", linnum =
20}, var=0x0) at expression.c:3914
3914        this->type = var->type;
Current language:  auto; currently c++
(gdb) bt

linnum = 20}, var=0x0) at expression.c:3914

func.c:1575

func.c:742

sc=0x96f14f8) at struct.c:88


) at mars.c:1115

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




PDT ---
The backtrace is for dmd svn r102.
This ticket may also need a better title.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |clugdbug yahoo.com.au
         OS/Version|Linux                       |All
           Severity|normal                      |regression


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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Compiler crash on invariant |Segfault(expression.c) on
                   |+ method overload           |invariant + method overload



Crashing in VarExp::VarExp(). 
var is NULL.

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


Don <clugdbug yahoo.com.au> changed:

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



func.c, line 1568 (DMD 1.050), in mergeFensure(): Need to check fdensure as 
well as fensure.

    FuncDeclaration *fdv = (FuncDeclaration *)foverrides.data[i];
    sf = fdv->mergeFensure(sf);
-    if (fdv->fensure)
+    if (fdv->fensure && fdv->fdensure)
    {
        //printf("fdv->fensure: %s\n", fdv->fensure->toChars());
        // Make the call: __ensure(result)
        Expression *eresult = NULL;

Likewise in mergeFrequire, line 1524 should probably be:

    FuncDeclaration *fdv = (FuncDeclaration *)foverrides.data[i];
    sf = fdv->mergeFrequire(sf);
-    if (fdv->frequire)
+    if (fdv->frequire && fdv->fdrequire)
    {
        //printf("fdv->frequire: %s\n", fdv->frequire->toChars());
        /* Make the call:
         *   try { __require(); }
         *   catch { frequire; }
         */
        Expression *eresult = NULL;
        Expression *e = new CallExp(loc, new VarExp(loc, fdv->fdrequire),
eresult);
        Statement *s2 = new ExpStatement(loc, e);

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




PDT ---
The test case compiles and runs with dmd svn r215.

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


Moritz Warning <moritzwarning web.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mk krej.cz



PDT ---
*** Issue 3405 has been marked as a duplicate of this issue. ***

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


Walter Bright <bugzilla digitalmars.com> changed:

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



11:30:59 PST ---
Fixed dmd 1.051 and 2.036

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