www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11611] New: dmd -O causes std.stdio.File.byLine to segfault

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: hsteoh quickfur.ath.cx


--- Comment #0 from hsteoh quickfur.ath.cx 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: -------
Nov 26 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11611


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Severity|normal                      |major


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11611


hsteoh quickfur.ath.cx changed:

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


--- Comment #1 from hsteoh quickfur.ath.cx 2013-11-26 16:55:16 PST ---
Gah, seems to be duplicate of issue #10723.

*** This issue has been marked as a duplicate of issue 10723 ***

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