← Back to index
|
Original Bugzilla link
Bug 4036 – Segfault with -inline and literal of struct containing union
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2010-04-01T05:34:00Z
Last change time
2014-02-15T02:19:41Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
matti.niemenmaa+dbugzilla
Comments
Comment #0
by matti.niemenmaa+dbugzilla — 2010-04-01T05:34:25Z
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
Comment #1
by clugdbug — 2010-04-08T23:55:12Z
PATCH: Uninitialized variable causing memory corruption. bug 4036. inline.c, arrayExpressiondoInline(), line 460. --------- if (e) { e = e->doInline(ids); newa->data[i] = (void *)e; } + else + newa->data[i] = 0;
Comment #2
by clugdbug — 2010-05-05T19:08:32Z
Fixed DMD2.044