[Issue 1696] New: for(;;) in CTFE segfaults compiler
Ary Borenszweig
ary at esperanto.org.ar
Wed Nov 28 05:59:05 PST 2007
d-bugmail at 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 at digitalmars.com
> ReportedBy: clugdbug at 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.
More information about the Digitalmars-d-bugs
mailing list