www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4864] New: ICE(statement.c) Crash on invalid 'if statement' body inside mixin

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

           Summary: ICE(statement.c) Crash on invalid 'if statement' body
                    inside mixin
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: yebblies gmail.com


--- Comment #0 from yebblies <yebblies gmail.com> 2010-09-14 00:01:51 PDT ---
----- reduced test case -----

void main()
{
    mixin("if (0) % ;");
}
-----------------------------

IfStatement::semantic is called with (ifbody == null)
Seems like something that should be detected during parsing of the mixin.

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



--- Comment #1 from yebblies <yebblies gmail.com> 2010-09-15 02:13:58 PDT ---
Additional test case:

void main()
{
    mixin("if (a b) ;");
}

Another case of a broken if statement.
The crash goes away if a body is added to the if statement.

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


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-11-17 00:13:39 PST ---
PATCH: statement.c 337.
CompileStatement::flatten()

    Statements *a = new Statements();
    while (p.token.value != TOKeof)
    {
+       int olderrs = global.errors;
        Statement *s = p.parseStatement(PSsemi | PScurlyscope);
+       if (olderrs == global.errors) // discard it if parsing failed
            a->push(s);
    }

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2010-12-04
22:57:08 PST ---
http://www.dsource.org/projects/dmd/changeset/778

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



--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2010-12-04
22:57:26 PST ---
http://www.dsource.org/projects/dmd/changeset/778

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


Don <clugdbug yahoo.com.au> changed:

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


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