Thread overview
[Issue 716] New: -inline: conditinal compilation of an empty foreach body causes the compiler to segfault
Dec 22, 2006
d-bugmail
Mar 02, 2007
d-bugmail
Oct 31, 2007
d-bugmail
Nov 08, 2007
d-bugmail
Apr 01, 2009
d-bugmail
December 22, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=716

           Summary: -inline: conditinal compilation of an empty foreach body
                    causes the compiler to segfault
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


(Originally posted by Stewart Gordon <smjg_1998@yahoo.com> on 2005-04-18 as news:d4026v$nc0$5@digitaldaemon.com)

#
# int main(char[][] args) {
#    foreach(char[] p; args){
#       version(dummy) int i;
#    }
#    return 0;
# }
#

compiling with "dmd -inline sample.d" causes the compiler to segfault

test cases:
http://dstress.kuehne.cn/run/foreach_28.d
http://dstress.kuehne.cn/run/foreach_29.d
http://dstress.kuehne.cn/run/f/foreach_28_B.d


-- 

March 02, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=716


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jascha@mainia.de




------- Comment #1 from thomas-dloop@kuehne.cn  2007-03-02 08:28 -------
*** Bug 990 has been marked as a duplicate of this bug. ***


-- 

October 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=716


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2007-10-30 22:58 -------
Works with dmd 1.022 and 2.006


-- 

November 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=716


davidl@126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




------- Comment #3 from davidl@126.com  2007-11-08 07:05 -------
a patch is required.
inline.c 857
Statement *ForeachStatement::inlineScan(InlineScanState *iss)
{
    aggr = aggr->inlineScan(iss);
    if(body)
       body = body->inlineScan(iss);
    return this;
}


-- 

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


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
           Keywords|                            |patch
         Resolution|                            |FIXED




------- Comment #4 from clugdbug@yahoo.com.au  2009-04-01 07:19 -------
Works for me. The code in DMD 2.027 is exactly as described by David. I guess it was fixed at some point.


--