July 24, 2011 [Issue 6375] New: [CTFE] Segfault when using std.array.appender with an initial array | ||||
---|---|---|---|---|
| ||||
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: nobody@puremagic.com ReportedBy: kennytm@gmail.com --- Comment #0 from kennytm@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: ------- |
July 26, 2011 [Issue 6375] [CTFE] Segfault when using std.array.appender with an initial array | ||||
---|---|---|---|---|
| ||||
Posted in reply to kennytm@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=6375 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2011-07-26 15:19:16 PDT --- https://github.com/D-Programming-Language/dmd/commit/0904c8aa200e4d080d500d96d5904c33ba17cc86 https://github.com/D-Programming-Language/dmd/commit/e48a8c67f02172c72e04f36759d2d6868d716368 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation