Thread overview
[Issue 1533] New: Crash unknown symbol with std.signals
Sep 26, 2007
d-bugmail
Sep 26, 2007
d-bugmail
Sep 26, 2007
d-bugmail
Sep 26, 2007
d-bugmail
Sep 30, 2007
d-bugmail
Apr 20, 2009
d-bugmail
Apr 20, 2009
d-bugmail
September 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1533

           Summary: Crash unknown symbol with std.signals
           Product: D
           Version: 2.004
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: regan@netmail.co.nz


Crashes on compile:

import std.c.windows.windows; import std.signals;

class ChildProcesses
{
    void foobar()
    {
        void delegate(int) retCodeCall;
        PHandle p;
        foo();  //trigger
        p.retCodeSignal.connect(retCodeCall);
    }

    class PHandle
    {
        mixin Signal!(int) retCodeSignal;
    }
}

Compile with "dmd file.d".

Remove line marked trigger and there is no crash.


-- 

September 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1533


matti.niemenmaa+dbugzilla@iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
            Version|2.004                       |1.021




------- Comment #1 from matti.niemenmaa+dbugzilla@iki.fi  2007-09-26 07:23 -------
Confirmed on 1.021 as well. A shorter version:

import std.signals;

class ChildProcesses
{
    void foobar()
    {
        foo();  //trigger
        this.retCodeSignal;
    }

    mixin Signal!(int) retCodeSignal;
}


-- 

September 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1533





------- Comment #2 from wbaxter@gmail.com  2007-09-26 12:00 -------
The error message printed just before the compiler crashes is amusing:

sigbug.d(7): Error: undefined identifier foo
sigbug.d(7): Error: function expected before (), not foo of type int
sigbug.d(236): function sigbug.ChildProcesses.foobar.Signal!(int)._dtor
destruct
ors only are for class definitions


line 236.. of a 13 line program.

But should an ice-on-invalid really be marked Severity:critical?


-- 

September 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1533


matti.niemenmaa+dbugzilla@iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |major




------- Comment #3 from matti.niemenmaa+dbugzilla@iki.fi  2007-09-26 12:20 -------
(In reply to comment #2)
> The error message printed just before the compiler crashes is amusing:
> 
> sigbug.d(7): Error: undefined identifier foo
> sigbug.d(7): Error: function expected before (), not foo of type int
> sigbug.d(236): function sigbug.ChildProcesses.foobar.Signal!(int)._dtor
> destruct
> ors only are for class definitions
> 
> line 236.. of a 13 line program.

The mixin pulls in a bunch of stuff. DMD isn't smart enough to point to the actual line where the code is, pointing only to the mixin-expanded code (which you can't even ever see since there's nothing like C compilers' -E).

> But should an ice-on-invalid really be marked Severity:critical?

I don't think so. Changing to major.


-- 

September 30, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1533


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All




------- Comment #4 from thomas-dloop@kuehne.cn  2007-09-30 05:00 -------
The below condensed invalid code also triggers this ICE:

# template T(){
#    this(){
#    }
#
#    int dummy;
# }
#
# class C{
#    void foo(){
#       bar();
#       this.t.dummy = 1;
#    }
#    mixin T!() t;
# }

Added to DStress as http://dstress.kuehne.cn/run/t/this_16_A.d http://dstress.kuehne.cn/nocompile/t/this_16_B.d http://dstress.kuehne.cn/nocompile/t/this_16_C.d http://dstress.kuehne.cn/nocompile/t/this_16_D.d


-- 

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


clugdbug@yahoo.com.au changed:

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




------- Comment #5 from clugdbug@yahoo.com.au  2009-04-20 02:34 -------
DMD2.028. func.c, line 954. Don't try to call the invariant if earlier errors have meant we don't have a 'this'.

---------
            // Postcondition invariant
            if (addPostInvariant())
            {
                        if (!ad) return;   // <--- add this line
                Expression *e = NULL;
                if (isCtorDeclaration()){
                    // Call invariant directly only if it exists
--------


-- 

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


clugdbug@yahoo.com.au changed:

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




------- Comment #6 from clugdbug@yahoo.com.au  2009-04-20 04:09 -------
Same as bug 642, case 14G.

*** This bug has been marked as a duplicate of 642 ***


--