Fix twolf -funroll-loops -O3 miscompilation (a semi-latent web.c bug)

Steven Bosscher stevenb.gcc@gmail.com
Tue Nov 27 13:04:00 GMT 2012


On Tue, Nov 27, 2012 at 1:28 PM, Steven Bosscher wrote:
> Dominique, could you give this a try and see if it helps?
> (But as I said up-thread: I'm not sure this is a proper fix, or just
> another band-aid...)

And more band-aid, but this time I'm not even sure where things go
wrong. In any case, we end up with a REG_EQUAL note referencing a
SUBREG of a dead register. This leaked because df_remove_dead_eq_notes
uses loc_mentioned_in_p not on the note but on the first operand of
the note.

Index: df-problems.c
===================================================================
--- df-problems.c       (revision 193394)
+++ df-problems.c       (working copy)
@@ -2907,9 +2907,10 @@ df_remove_dead_eq_notes (rtx insn, bitma
                if (DF_REF_REGNO (use) > FIRST_PSEUDO_REGISTER
                    && DF_REF_LOC (use)
                    && (DF_REF_FLAGS (use) & DF_REF_IN_NOTE)
-                   && ! bitmap_bit_p (live, DF_REF_REGNO (use))
-                   && loc_mentioned_in_p (DF_REF_LOC (use), XEXP (link, 0)))
+                   && ! bitmap_bit_p (live, DF_REF_REGNO (use)))
                  {
+                   /* Make sure that DF_SCAN is up-to-date.  */
+                   gcc_assert (loc_mentioned_in_p (DF_REF_LOC (use), link));
                    deleted = true;
                    break;
                  }



More information about the Gcc-patches mailing list