[Issue 11611] New: dmd -O causes std.stdio.File.byLine to segfault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 26 16:18:16 PST 2013
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 at puremagic.com
ReportedBy: hsteoh at quickfur.ath.cx
--- Comment #0 from hsteoh at 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: -------
More information about the Digitalmars-d-bugs
mailing list