Bug 4655 – Regression(1.063, 2.048) goto to a try block ICEs

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-08-16T12:43:00Z
Last change time
2015-06-09T05:11:54Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
baseball.mjp

Comments

Comment #0 by baseball.mjp — 2010-08-16T12:43:27Z
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 by baseball.mjp — 2010-08-16T12:48:49Z
It may also be related to Issue 235. The code posted there has the same behaviour as what is posted here.
Comment #2 by clugdbug — 2010-08-20T03:35:55Z
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 by bugzilla — 2010-08-26T23:27:30Z
Comment #4 by clugdbug — 2010-09-04T18:31:38Z
*** Issue 4811 has been marked as a duplicate of this issue. ***