[Issue 4036] New: Segfault with -inline and literal of struct containing union

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 1 05:34:28 PDT 2010


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

           Summary: Segfault with -inline and literal of struct containing
                    union
           Product: D
           Version: 1.057
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: matti.niemenmaa+dbugzilla at iki.fi


--- Comment #0 from Matti Niemenmaa <matti.niemenmaa+dbugzilla at iki.fi> 2010-04-01 05:34:25 PDT ---
struct XY { union { int x, y; } }
struct AHolder {
    XY aa;
    void a(XY x) { aa = x; }
}
struct AB {
    AHolder aHolder;
    XY b;
    void a(XY x) { aHolder.a(x); }
}
struct Main {
    AB ab;

    void setB() { ab.b = XY(); }
    void f() {
        ab.a(XY.init);
        setB();
    }
}

$ dmd -c -inline arst.d
Segmentation fault

Any of the following semantics-preserving changes will fix it:

- Making Main.setB use XY.init instead of XY()
- Inlining ab.a(XY.init) into Main.f
- Inlining setB() into Main.f
- Inlining aHolder.a(x) into AB.a

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