www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1696] New: for(;;) in CTFE segfaults compiler

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

           Summary: for(;;) in CTFE segfaults compiler
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: clugdbug yahoo.com.au


Seems it's not checking for an empty iteration clause.
Putting _anything_ in there, eg for(;;null) stops the segfault.
---------
int a()
{
    bool b = false;
    for (;;) {
        if (b) return 0;
        b = true;
    }
}

const c = a();


-- 
Nov 28 2007
next sibling parent Ary Borenszweig <ary esperanto.org.ar> writes:
d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=1696
 
            Summary: for(;;) in CTFE segfaults compiler
            Product: D
            Version: 1.023
           Platform: PC
         OS/Version: Windows
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: clugdbug yahoo.com.au
 
 
 Seems it's not checking for an empty iteration clause.
 Putting _anything_ in there, eg for(;;null) stops the segfault.
 ---------
 int a()
 {
     bool b = false;
     for (;;) {
         if (b) return 0;
         b = true;
     }
 }
 
 const c = a();
 
 
What if there is a break somewhere in the empty for? The compiler can't know that the function will end it's execution. I think it would be weird if the compiler didn't hang up or segfault on this.
Nov 28 2007
prev sibling next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1696


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |ice-on-valid-code





Ary, what do you mean by this?

And please don't quote the entire message posted to the newsgroup when
replying.  It's bad enough on any newsgroup, and when it clutters up Bugzilla,
it's even worse.


-- 
Nov 28 2007
parent Ary Borenszweig <ary esperanto.org.ar> writes:
Sorry, I meant nothing. I was very drowsy I guess.
Nov 28 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1696


davidl 126.com changed:

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







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


-- 
Dec 09 2007