With the attached patch applied, immuses get hosed during update_stmt while propagating in ccp at tree-ssa-propagate.c:1154 (substitute_and_fold calling mark_new_vars_to_rename). Testcase:
struct B { int i; }; struct C { struct B c[1]; }; int e; static struct C b; void foo (int d) { struct C *x = &b; b.c[0].i = 424242; /* CCP destroys immuses of d */ e = x->c[d].i; } we just have substituted &b into x and folded it to D.1618_6 = bD.1612.cD.1610[dD.1613_5].iD.1608 update_stmt on this will remove the immediate use of dD.1613_5 which then DCE happily removes and we ICE in verify_ssa of it. Just before CCP the trees look like foo (dD.1613) { struct C * xD.1616; intD.0 D.1618; intD.0 d.0D.1617; # BLOCK 0 # PRED: ENTRY (fallthru) xD.1616_1 = &bD.1612; # SFT.1D.1625_3 = V_MUST_DEF <SFT.1D.1625_2>; bD.1612.cD.1610[0].iD.1608 = 424242; dD.1613_5 = dD.1613_4; # VUSE <SFT.1D.1625_3>; D.1618_6 = xD.1616_1->cD.1610[dD.1613_5].iD.1608; # eD.1611_8 = V_MUST_DEF <eD.1611_7>; eD.1611 = D.1618_6; return; # SUCC: EXIT } with a single use of dD.1613_5. -- Summary: immediate uses hosed after CCP Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23297