D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4655 - Regression(1.063, 2.048) goto to a try block ICEs
Summary: Regression(1.063, 2.048) goto to a try block ICEs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
: 4811 (view as issue list)
Depends on:
Blocks:
 
Reported: 2010-08-16 12:43 UTC by Michael Parrott
Modified: 2015-06-09 05:11 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Michael Parrott 2010-08-16 12:43:27 UTC
This is most likely related to something done for Issue 4339.

void main()
{   
    goto L1;
    try 
    { 
        L1:
            int a;
    }
    catch { }
}

produces:

Internal error: ../ztc/cgcod.c 989

This is a regression, as the error "test.d(6): Error: cannot goto forward into different try block level" is raised in 1.062.

Note that moving the "goto L1;" line below the try/catch/finally produces the error "test.d(9): Error: cannot goto into try block" on both dmd 1.062 and 1.063.
Comment 1 Michael Parrott 2010-08-16 12:48:49 UTC
It may also be related to Issue 235. The code posted there has the same behaviour as what is posted here.
Comment 2 Don 2010-08-20 03:35:55 UTC
Silly mistake in the implementation of forward references, in the patch for 4339. It remembers the block the label is in, when it should be recording the block which it was referenced from.

PATCH: s2ir.c, line 107, labelToBlock()

            // Keep track of the forward reference to this block, so we can check it later
            if (!s->fwdrefs)
                s->fwdrefs = new Array();
-            s->fwdrefs->push(s->lblock);
+            s->fwdrefs->push(blx->curblock);
        }
    }
    return s->lblock;
Comment 3 Walter Bright 2010-08-26 23:27:30 UTC
http://www.dsource.org/projects/dmd/changeset/631
Comment 4 Don 2010-09-04 18:31:38 UTC
*** Issue 4811 has been marked as a duplicate of this issue. ***