Bug 15755 – DMD segfault upon alias on alias on __trait(getAttributes, ...)

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-03-04T13:37:44Z
Last change time
2018-06-19T07:20:40Z
Keywords
ice
Assigned to
No Owner
Creator
Alexander Tumin

Comments

Comment #0 by iamtakingiteasy — 2016-03-04T13:37:44Z
The following code segfaults dmd 2.070 on current master HEAD : 07217cc3e05d465dff8341cf90f7710b94e02070 : --->3--- struct Foo { @(123) int a; } template Attributes(As...) { alias Attributes = As; } template getattribute(alias member, alias attrs = Attributes!(__traits(getAttributes, member))) { alias getattribute = attrs; } void main() { getattribute!(__traits(getMember, Foo, "a")); } --->3--- Result: Compilation error / Return code: 11 (Segmentation fault)
Comment #1 by ketmar — 2016-03-04T13:53:39Z
it segfaults when it tries to print this error inside `hasNestedArgs` in dtemplate.d: error("%s is nested in both %s and %s", toChars(), enclosing.toChars(), dparent.toChars()); somehow it ends in "nested" checks with `Dsymbol dparent = sa.toParent2();` as `null`, and don't bother to double-check if template really has any parent. it seems that adding a simple check there doesn't really breaks anything (it shouldn't! ;-), so it can be used as workaround until the real fix will be done.
Comment #2 by razvan.nitu1305 — 2018-06-12T15:17:25Z
Comment #3 by github-bugzilla — 2018-06-19T07:20:36Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/f11c8ba75ca131df0c228fde9e81b7df07fb7490 Fix Issue 15755 - DMD segfault upon alias on alias on __trait(getAttributes, ...) https://github.com/dlang/dmd/commit/d23320ce8c4d17e816b425d5aadddde34272238e Merge pull request #8353 from RazvanN7/Issue_15755 Fix Issue 15755 - DMD segfault upon alias on alias on __trait(getAttributes, ...)