Thread overview
[Issue 2064] New: Dmd faults
May 02, 2008
d-bugmail
[Issue 2064] Segfault with mixin(for/foreach) with empty loop body
Jun 23, 2008
d-bugmail
Apr 03, 2009
d-bugmail
Apr 18, 2009
d-bugmail
May 02, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2064

           Summary: Dmd faults
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: bartosz@relisoft.com


This (incorrect) program causes the compiler to fault.

import std.stdio;
import std.string;
void main ()
{
        string s = "abc";
        mixin ("foreach (c; s)");
        {
                writeln (c);
        }
}


-- 

June 23, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2064


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
            Summary|Dmd faults                  |Segfault with
                   |                            |mixin(for/foreach) with
                   |                            |empty loop body




------- Comment #1 from clugdbug@yahoo.com.au  2008-06-23 08:07 -------
Reduced test case, shows that the problem is a for/foreach with empty body. I've changed the bug title accordingly. Also happens on dmd 1.031.

----
void main ()
{
        mixin (`for(;;)`);
}
---
bug.d(3): found 'EOF' instead of statement
then segfaults.


-- 

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


clugdbug@yahoo.com.au changed:

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




------- Comment #2 from clugdbug@yahoo.com.au  2009-04-03 06:30 -------
statement.c,  in Statement *ForStatement::semantic(Scope *sc)

around line 1129. body = body->semantic(sc);
but body is null in this case.

Trivial fix:

    if (body) body = body->semantic(sc);


-- 

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


clugdbug@yahoo.com.au changed:

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




------- Comment #3 from clugdbug@yahoo.com.au  2009-04-18 01:03 -------
Fixed DMD2.028


--