https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107183
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Seems the bug is in swap_rtx_condition. It is called on: (insn 10023 10021 10024 4 (set (reg:CCFP 17 flags) (unspec:CCFP [ (compare:CCFP (reg:XF 9 st(1) [orig:84 _3 ] [84]) (reg:XF 8 st [107])) ] UNSPEC_NOTRAP)) "pr107183.c":6:18 discrim 1 45 {*cmpiuxf_i387} (expr_list:REG_DEAD (reg:XF 9 st(1) [orig:84 _3 ] [84]) (expr_list:REG_DEAD (reg:XF 8 st [107]) (nil)))) on the first next_flags_user call in the function it sets insn to: (insn 10110 10024 10111 4 (set (reg:QI 3 bx [105]) (unordered:QI (reg:CCFP 17 flags) (const_int 0 [0]))) "pr107183.c":6:18 discrim 1 949 {*setcc_qi} (nil)) (still the same between -g and -g0, but already that one could differ), but then next_flags_user (the 3rd one in the function) finds (debug_insn 4 10029 10030 4 (var_location:SI D#1 (if_then_else:SI (uneq (reg:CCFP 17 flags) (const_int 0 [0])) (reg:SI 3 bx [105]) (reg:SI 0 ax [111]))) -1 (nil)) with -g and (insn 10030 10029 10032 4 (set (reg:SI 3 bx [orig:90 iftmp.0_9 ] [90]) (if_then_else:SI (uneq (reg:CCFP 17 flags) (const_int 0 [0])) (reg:SI 3 bx [105]) (reg:SI 0 ax [111]))) "pr107183.c":6:18 discrim 1 1269 {*movsicc_noc} (expr_list:REG_DEAD (reg:CCFP 17 flags) (expr_list:REG_DEAD (reg:SI 0 ax [111]) (expr_list:REG_EQUAL (if_then_else:SI (uneq (reg:CCFP 17 flags) (const_int 0 [0])) (reg:SI 3 bx [105]) (const_int 1 [0x1])) (nil))))) with -g0.