http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59715
--- Comment #5 from vries at gcc dot gnu.org --- The test passes with -fno-tree-tail-merge. But I don't see anything wrong with the transformation (merging of empty blocks) done by the pass. AFAICT, the problem is introduced by pass_dominator. test.c.126t.slsr looks ok, but test.c.127t.dom2 look wrong. The test passes with -fno-tree-dominator-opts. test.c.126t.slsr: ... <bb 2>: b.0_4 = b; if (b.0_4 == 0) goto <bb 4>; else goto <bb 3>; <bb 3>: goto <bb 7>; <bb 4>: a.1_5 = a; if (a.1_5 != 0) goto <bb 5>; else goto <bb 6>; <bb 5>: b = a.1_5; c_7 = 1 % a.1_5; if (c_7 != 0) goto <bb 6>; else goto <bb 3>; <bb 6>: b = 0; <bb 7>: b.0_9 = b; printf ("%d\n", b.0_9); return 0; ... we're taking the path bb2 -> bb4 -> bb5 (b = 2) -> bb6 (b = 0) -> bb7 test.c.127t.dom2: ... <bb 2>: b.0_4 = b; if (b.0_4 == 0) goto <bb 4>; else goto <bb 3>; <bb 3>: goto <bb 6>; <bb 4>: a.1_5 = a; if (a.1_5 != 0) goto <bb 5>; else goto <bb 6>; <bb 5>: b = a.1_5; c_7 = 1 % a.1_5; if (c_7 != 0) goto <bb 6>; else goto <bb 3>; <bb 6>: b.0_9 = b; printf ("%d\n", b.0_9); return 0; ... we're taking the path bb2 -> bb4 -> bb5 (b = 2) -> bb6