Bug 19473 – DMD Segfault on circular struct reference
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2018-12-10T16:18:04Z
Last change time
2018-12-16T20:53:44Z
Assigned to
No Owner
Creator
deadalnix
Comments
Comment #0 by deadalnix — 2018-12-10T16:18:04Z
DMD Segfault on the following sample code:
struct A {
P p;
struct UTpl() {
union {
P p;
}
}
alias U() = UTpl!();
}
alias B = A.U!();
struct C {
union D {
B b;
}
}
union P {
C.D p;
}
I have not been able to reduce the sample case further and I'm not quite sure what's going on.
Comment #1 by deadalnix — 2018-12-10T17:01:36Z
Running on older version of DMD tells me it is a regression.
2.066.0 to 2.071.2: Failure with output: onlineapp.d(21): Error: union onlineapp.P no size yet for forward reference
Comment #2 by bugzilla — 2018-12-12T11:39:46Z
There's certainly an unresolvable circular thing going on here.
Comment #3 by bugzilla — 2018-12-12T23:26:12Z
It's an infinite loop trying to determine the sizes for:
P => D => UTpl => P ...
resulting in a stack overflow.