Bug 18819 – DMD compilation crash

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-03T04:48:15Z
Last change time
2018-06-03T18:30:14Z
Assigned to
No Owner
Creator
Nathan S.
See also
https://issues.dlang.org/show_bug.cgi?id=18871

Attachments

IDFilenameSummaryContent-TypeSize
1690this_will_crash.dReduced example of crashing codetext/plain706

Comments

Comment #0 by n8sh.secondary — 2018-05-03T04:48:15Z
Created attachment 1690 Reduced example of crashing code DMD crashes when trying to compile attached file.
Comment #1 by kinke — 2018-05-03T14:19:08Z
I just glanced at the code, but it appears invalid (specifically, emplaceRef() for a 0-sized T), see https://github.com/dlang/phobos/pull/6480.
Comment #2 by kinke — 2018-05-03T14:21:40Z
(In reply to kinke from comment #1) > I just glanced at the code, but it appears invalid (specifically, > emplaceRef() for a 0-sized T), see https://github.com/dlang/phobos/pull/6480. Disregard, there's no 0-sized type in there, and DMD obviously shouldn't crash anyway.
Comment #3 by slavo5150 — 2018-05-20T14:47:05Z
I can reproduce this at run.dlang.io, but I can't reproduce it locally from DMD-Head (Linux 64-bit). DMD-Head gives me this: main.d(19): Error: false has no effect main.d(34): Error: template instance `main.emplaceInitializer!(S)` error instantiating main.d(24): instantiated from here: emplaceRef!(Problem[4]) main.d(15): instantiated from here: emplaceRef!(Problem[4], Problem)
Comment #4 by ag0aep6g — 2018-05-20T21:12:23Z
(In reply to Mike Franklin from comment #3) > I can reproduce this at run.dlang.io, but I can't reproduce it locally from > DMD-Head (Linux 64-bit). I can reproduce it just fine on Linux with DMD64 D Compiler v2.080.0-166-g235e5b500 (i.e. git master). Crashes with: core.exception.AssertError@dmd/dinterpret.d(4834): Assertion failure That's here: <https://github.com/dlang/dmd/blob/235e5b50052b3910fec36cb949cc43502267ea82/src/dmd/dinterpret.d#L4834>. Also, reduced test case: ---- struct Problem { ~this() {} } struct S { Problem[1] payload; } enum theTemplateB = { static foreach (e; S.init.tupleof) {} return true; }(); ----
Comment #5 by slavo5150 — 2018-05-21T03:11:52Z
> but I can't reproduce it locally from DMD-Head (Linux 64-bit). Disregard that; I had code for https://github.com/dlang/dmd/pull/8260 in my local copy. That being said https://github.com/dlang/dmd/pull/8260 seems to fix this.
Comment #6 by github-bugzilla — 2018-06-03T18:30:08Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b8f3b7a9f1e33d3c130a04e1459ca601cad7127a Fix Issue 18871 & 18819 - DMD illegal hardware instruction crash https://github.com/dlang/dmd/commit/d2d7cc1cc847b7fc9e762924f4ab584474b6219f Merge pull request #8260 from JinShil/fix_18871 Fix Issue 18871 & 18819 - DMD illegal hardware instruction crash merged-on-behalf-of: Jacob Carlborg <[email protected]>