Bug 17969 – [REG 2.077.0] dmd 2.077.0 crashes when computing mangling symbol for simple program

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-11-06T12:04:08Z
Last change time
2017-11-30T09:06:53Z
Keywords
ice, pull
Assigned to
No Owner
Creator
Atila Neves

Comments

Comment #0 by atila.neves — 2017-11-06T12:04:08Z
This code causes dmd 2.070.0 to crash: void foo() { struct Data { double value; } oops([Data()]); } void oops(Data)(Data[] data) { import std.algorithm: map; auto values = [data].map!(a => a.map!(b => b.value).sum); } Earlier versions aren't affected. Notice that `sum` isn't imported. If it is, the crash goes away. If `b.value` is replaced with `b.foo` (or any other name that doesn't exist in the struct), it also crashes, so it seems to have to do with the function failing to compile. The stack trace points to _ZN7Mangler14mangleFuncTypeEP12TypeFunctionS1_hP4Type.
Comment #1 by ag0aep6g — 2017-11-06T17:58:44Z
Reduced: ---- alias fun = a => MapResult2!(b => b).sum; int[] e; static assert(!is(typeof(fun(e)) == void)); void foo() { fun(e); } struct MapResult2(alias fun) { int[] _input; } ----
Comment #2 by r.sagitario — 2017-11-07T08:34:25Z
Comment #3 by github-bugzilla — 2017-11-07T09:20:13Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/e926c4481d875cd406a6697de6b07f0f40d1969b fix issue 17969 - crash when computing mangling of erroneous function type be more permissive mangling functions that failed semantic analysis and have type TypeError https://github.com/dlang/dmd/commit/9b86ddd6e8cc7745de01887f7d9e514c4fd7df19 Merge pull request #7293 from rainers/issue_17969 fix issue 17969 - crash when computing mangling of erroneous function type merged-on-behalf-of: Walter Bright <[email protected]>
Comment #4 by github-bugzilla — 2017-11-30T09:06:53Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/e926c4481d875cd406a6697de6b07f0f40d1969b fix issue 17969 - crash when computing mangling of erroneous function type https://github.com/dlang/dmd/commit/9b86ddd6e8cc7745de01887f7d9e514c4fd7df19 Merge pull request #7293 from rainers/issue_17969