[Issue 10723] New: std.stdio.File.byLine causes segfault when compiling with -O

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 27 17:23:38 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10723

           Summary: std.stdio.File.byLine causes segfault when compiling
                    with -O
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: hsteoh at quickfur.ath.cx


--- Comment #0 from hsteoh at quickfur.ath.cx 2013-07-27 17:23:36 PDT ---
Code:
------
import std.stdio;
void main() {
    try {
        auto f = File("/non/existent/file").byLine();
    } catch(Exception e) {
        writeln(e.msg);
    }
}
------

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

Program output:
------
Segmentation fault
------

Compiling without -O doesn't exhibit this problem.

Here's the stacktrace from gdb:

#0  0x0000000000440110 in std.stdio.File.detach() ()
#1  0x000000000043fe09 in std.stdio.File.__dtor() ()
#2  0x000000000043179a in D main ()
#3  0x000000000043c854 in rt.dmain2._d_run_main() ()
#4  0x000000000043c0de in rt.dmain2._d_run_main() ()
#5  0x000000000043c8b0 in rt.dmain2._d_run_main() ()
#6  0x000000000043c0de in rt.dmain2._d_run_main() ()
#7  0x000000000043c09a in _d_run_main ()
#8  0x000000000043bea0 in main ()


Looks like -O is causing the compiler to generate wrong code in this case.

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


More information about the Digitalmars-d-bugs mailing list