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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 15 10:53:49 PDT 2013


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



--- Comment #3 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-08-15 10:53:46 PDT ---
Reduced:

struct File
{
    private struct Impl
    {
        uint refs = uint.max / 2;
    }
    private Impl* _p;
    private string _name;

    this(string name, in char[] stdioOpenmode = "rb")
    {
       _p = new Impl();
       _p.refs = 1;
       throw new Exception(name);
    }

    ~this() {
        assert(_p.refs);
        --_p.refs;
        _p = null;
    }

    int byLine() {
        return 0;
    }
}

void main() {
    try {
        int f = File("It's OK").byLine();
    } catch(Exception e) { }
}

Interesting is that if _name member or in char[] stdioOpenmode = "rb" are
removed, the program runs fine.

-- 
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