D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4811 - ICE when goto into try/catch block
Summary: ICE when goto into try/catch block
Status: RESOLVED DUPLICATE of issue 4655
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2010-09-04 08:17 UTC by Iain Buclaw
Modified: 2010-09-04 18:31 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2010-09-04 08:17:53 UTC
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 Don 2010-09-04 18:31:38 UTC

*** This issue has been marked as a duplicate of issue 4655 ***