https://d.puremagic.com/issues/show_bug.cgi?id=11611

           Summary: dmd -O causes std.stdio.File.byLine to segfault
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2013-11-26 16:18:13 PST ---
CODE:
-----
import std.stdio;

void func(R)(R input) { }

version=bad;

void main()
{
    try
    {   
        version(bad)
            func(File("").byLine());

        version(good)
        {   
            auto f = File("");
            func(f.byLine());
        }
    }
    catch(Exception e)
    {
    }
}
-----

Compile command:
-----
dmd -O test.d
-----

Changing to version=good makes the problem go away; dropping the -O flag in the
compile command also makes the problem go away. Based on this, it would appear
that the problem comes from the optimizer interacting badly with the RefCounted
implementations of File/ByLine. I'm unsure where the bug lies: in the
optimizer, or in std.stdio; but my guess is that the optimizer is producing
wrong code with structs containing dtors.

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

Reply via email to