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

           Summary: [CTFE] Segfault when using std.array.appender with an
                    initial array
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: kenn...@gmail.com


--- Comment #0 from kenn...@gmail.com 2011-07-24 14:41:19 PDT ---
Test case:

-----------------------------
struct D6375 {
    int[] arr;
}
A6375 a6375(int[] array) {
    return A6375(array);
}
struct A6375 {
    D6375* _data;
    this(int[] arr) {
        _data = new D6375;
        _data.arr = arr;
    }
    int[] data() {
        return _data.arr;
    } 
}
static assert({
    int[] a = [ 1, 2 ];
    auto app2 = a6375(a);
    auto data = app2.data();
    return true;
}());
-----------------------------
Bus error: 10
-----------------------------

This is essentially the trimmed down version of the unit test for
std.array.appender, running in CTFE. The segfault is due to
StructLiteralExp::getField in expression.c:

   if (e->type->castMod(0) != type->castMod(0) && type->ty == Tsarray)
   //     ^^^^ e->type is NULL

Running e->semantic() once fixed the issue, but I'm not sure if this is the
best solution.

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

Reply via email to