Bug 4811 – ICE when goto into try/catch block

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2010-09-04T08:17:00Z
Last change time
2010-09-04T18:31:38Z
Keywords
accepts-invalid, ice-on-invalid-code
Assigned to
nobody
Creator
ibuclaw

Comments

Comment #0 by ibuclaw — 2010-09-04T08:17:53Z
The test case: void main() { goto L1; try { L1: { } } catch { } } Results in an ICE when trying to compile. Internal error: ../ztc/cgcod.c 989 Similarly, this produces bad codegen. void main() { goto L1; try { } catch { L1: { } } } And a segmentation fault occurs during runtime. My guess is that because the try{} body is empty, the entire block gets optimised out, but the goto statement is still left in, where it now jumps to an invalid/null address.
Comment #1 by clugdbug — 2010-09-04T18:31:38Z
*** This issue has been marked as a duplicate of issue 4655 ***