Bug 17688 – ICE with static foreach directly inside switch

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-25T23:59:11Z
Last change time
2017-08-16T13:24:11Z
Keywords
ice, ice-on-valid-code
Assigned to
No Owner
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2017-07-25T23:59:11Z
The following code generates an ICE: --- void main(){ final switch(1) static foreach(x;0..1){ case 1: return; } } --- --- Statement::blockExit(0x7fe21d91c360) static foreach (x; 0 .. 1) { case 1: { return ; } } core.exception.AssertError@ddmd/blockexit.d(90): Assertion failure ---------------- --- The reason is that the DMD code base does not uphold some invariants I took for granted.
Comment #1 by timon.gehr — 2017-08-07T18:46:01Z
Comment #2 by github-bugzilla — 2017-08-08T22:07:23Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7ebda47f6a162ce3de774a042207eb883908b650 fix Issue 17688 - ICE with static foreach directly inside switch https://github.com/dlang/dmd/commit/e1e68148e0cd0eb1cfa21a8c0b24afcf7f3781f9 Merge pull request #7023 from tgehr/fix17688 fix Issue 17688 - ICE with static foreach directly inside switch merged-on-behalf-of: Walter Bright <[email protected]>
Comment #3 by github-bugzilla — 2017-08-16T13:24:11Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7ebda47f6a162ce3de774a042207eb883908b650 fix Issue 17688 - ICE with static foreach directly inside switch https://github.com/dlang/dmd/commit/e1e68148e0cd0eb1cfa21a8c0b24afcf7f3781f9 Merge pull request #7023 from tgehr/fix17688