Bug 17831 – [ICE] Internal error: backend/symbol.c 1039: foreach inside a switch statement

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-16T12:37:41Z
Last change time
2017-10-01T20:41:06Z
Assigned to
Iain Buclaw
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2017-09-16T12:37:41Z
Taken from recently introduce test case. https://github.com/dlang/dmd/pull/7120 --- int bug17807(){ int y=0; Lswitch: switch(2){ { case 0: break; } enum x=0; struct S{ enum x=0; } int foo(){ return 0; } default: y=x+S.x+foo(); foreach(i;1..5) case i: break Lswitch; } return y; } --- Removing the 'static' in foreach results in a compiler ICE.
Comment #1 by ibuclaw — 2017-09-16T13:21:51Z
Reduced test: --- void main() { switch (2) { foreach (i; 0 .. 5) case i: break; default: break; } } ---
Comment #2 by ibuclaw — 2017-09-16T13:32:29Z
Ah, don't even need a foreach. --- void main() { switch (0) { int i = 0; case i: break; default: break; } } ---
Comment #3 by ibuclaw — 2017-09-16T14:33:34Z
Comment #4 by ibuclaw — 2017-09-17T19:35:32Z
*** Issue 17834 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2017-09-24T00:16:35Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/e214161c1c5ff4524a85272a0bfd55c06416aeb6 fix Issue 17831 - [ICE] Internal error: backend/symbol.c 1039 https://github.com/dlang/dmd/commit/3034da225c2985564575f8b806c1f9646d041e57 Merge pull request #7139 from ibuclaw/ice17831 fix Issue 17831 - [ICE] Internal error: backend/symbol.c 1039 merged-on-behalf-of: Walter Bright <[email protected]>
Comment #6 by github-bugzilla — 2017-10-01T20:41:06Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/e214161c1c5ff4524a85272a0bfd55c06416aeb6 fix Issue 17831 - [ICE] Internal error: backend/symbol.c 1039 https://github.com/dlang/dmd/commit/3034da225c2985564575f8b806c1f9646d041e57 Merge pull request #7139 from ibuclaw/ice17831