www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11885] New: ICE(s2ir.c 359) with continuing a labeled ByLine (range struct w/ dtor) loop

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

           Summary: ICE(s2ir.c 359) with continuing a labeled ByLine
                    (range struct w/ dtor) loop
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: ice
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2014-01-09
13:52:38 EET ---
Simple test case:

////////////////////////////////////////////////////////////
import std.stdio;

void main()
{
    File f;
l:
    foreach (i; f.byLine)
        continue l;
}
////////////////////////////////////////////////////////////

Reduced test case:

////////////////////////////////////////////////////////////
struct ByLine
{
     property empty() { return false; }
    char[] front() { return null; }
    void popFront() { }
    ~this() { }
}

void main()
{
l:
    foreach (i; ByLine())
        continue l;
}
////////////////////////////////////////////////////////////

Although in the test cases the struct is a temporary, it doesn't matter - DMD
ICEs even if it's a global.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 09 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11885


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2014-02-07 17:49:28 EST ---
Reduced:

void main()
{
    l:
    for (auto x = ByLine();;)
        continue l;
}

Which gets transformed to this:

void main()
{
    l:
    {
        ByLine x = ByLine();
        try
        {
            for (;;)
            {
                continue l;
            }
        }
        finally
        {
            x.~this();
        }
    }
    return 0;
}

And now the l: is not on the for loop any more.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2014