https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> --- What happens here: if-to-switch conversion happens: (gdb) pcfun void n4 (int io, int vb) { double uc$1; double uc[2]; <bb 2> : if (io_6(D) == 0) goto <bb 3>; [INV] else goto <bb 5>; [INV] <bb 3> : <bb 5> : # uc$1_12 = PHI <2.0e+0(3), uc$1_12(7), 2.0e+0(2), 0.0(9), uc$1_12(5), uc$1_12(6)> <L12>: if (io_6(D) == 0) goto <bb 6>; [INV] else goto <bb 5>; [INV] <bb 6> : switch (vb_8(D)) <default: <L12> [INV], case 0: <L10> [INV], case 1: <L11> [INV]> <bb 7> : <L10>: goto <bb 5>; [INV] <bb 9> : <L11>: goto <bb 5>; [INV] } as seen, uc$1_12 = PHI <..., uc$1_12(6), ...> is properly fixed. The pass uses TODO_cleanup_cfg that corrupts the CFG in gimple_make_forwarder_block EMERGENCY DUMP: void n4 (int io, int vb) { double uc$1; double uc[2]; <bb 2> : <bb 3> : # uc$1_12 = PHI <2.0e+0(2), uc$1_12(5), (4), uc$1_12(3), 0.0(6)> <----- HERE <L13>: if (io_6(D) == 0) goto <bb 4>; [INV] else goto <bb 3>; [INV] <bb 4> : switch (vb_8(D)) <default: <L13> [INV], case 0: <L10> [INV], case 1: <L11> [INV]> <bb 5> : <L10>: goto <bb 3>; [INV] <bb 6> : <L11>: goto <bb 3>; [INV] } @Richi: What am I doing wrong?