[Bug rtl-optimization/61801] sched2 miscompiles syscall sequence with -g

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 16 08:29:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's combine combining 120 into 123 and on the way via propagate_for_debug
replacing reg:SI 126 with the asm in the debug_insn.

(insn 120 119 122 15 (parallel [
            (set (reg:SI 126 [ resultvar ])
                (asm_operands/v:SI ("xchgl %%ebx, %%edi
        int $0x80
        xchgl %%edi, %%ebx
...
(debug_insn 122 120 123 15 (var_location:SI resultvar (reg:SI 126 [ resultvar
])) bug-887141_pthread_create.1.min.i:77 -1
     (nil))
(insn 123 122 124 15 (set (reg/v:SI 84 [ result ])
        (reg:SI 126 [ resultvar ])) bug-887141_pthread_create.1.min.i:77 90
{*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 126 [ resultvar ])
        (nil)))

So to avoid generating debug-insns with asm_operands loc maybe do

Index: valtrack.c
===================================================================
--- valtrack.c  (revision 212580)
+++ valtrack.c  (working copy)
@@ -197,6 +197,12 @@ propagate_for_debug (rtx insn, rtx last,
       next = NEXT_INSN (insn);
       if (DEBUG_INSN_P (insn))
        {
+         if (GET_CODE (src) == ASM_OPERANDS)
+           {
+             INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
+             df_insn_rescan (insn);
+             continue;
+           }
          loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn),
                                         dest, propagate_for_debug_subst, &p);
          if (loc == INSN_VAR_LOCATION_LOC (insn))

which "fixes" the bug.



More information about the Gcc-bugs mailing list