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

login
register
mail settings
Submitter Steven Bosscher
Date Nov. 27, 2012, 1:04 p.m.
Message ID <CABu31nPUNnpNFUv=g-HSSsy7eU2S0DrSLywoCSF7NBCNSWC_1A@mail.gmail.com>
Download mbox | patch
Permalink /patch/202212/
State New
Headers show

Comments

Steven Bosscher - Nov. 27, 2012, 1:04 p.m.
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.
Dominique Dhumieres - Nov. 27, 2012, 2:25 p.m.
> And more band-aid, ...

The gcc_assert triggers at bootstrap when compiling gcc/ada/ali.adb:

+===========================GNAT BUG DETECTED==============================+
| 4.8.0 20121127 (experimental) [trunk revision 193848p10] (x86_64-apple-darwin10.8.0) GCC error:|
| in df_remove_dead_eq_notes, at df-problems.c:2917                        |
| Error detected around ../../work/gcc/ada/ali.adb:2682:8                  |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

Dominique
Steven Bosscher - Nov. 27, 2012, 2:48 p.m.
On Tue, Nov 27, 2012 at 3:25 PM, Dominique Dhumieres <dominiq@lps.ens.fr> wrote:
>> And more band-aid, ...
>
> The gcc_assert triggers at bootstrap when compiling gcc/ada/ali.adb:
>
> +===========================GNAT BUG DETECTED==============================+
> | 4.8.0 20121127 (experimental) [trunk revision 193848p10] (x86_64-apple-darwin10.8.0) GCC error:|
> | in df_remove_dead_eq_notes, at df-problems.c:2917                        |
> | Error detected around ../../work/gcc/ada/ali.adb:2682:8                  |
> | Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
> | Use a subject line meaningful to you and us to track the bug.            |
> | Include the entire contents of this bug box in the report.               |
> | Include the exact gcc or gnatmake command that you entered.              |
> | Also include sources listed below in gnatchop format                     |
> | (concatenated together with no headers between files).                   |
> +==========================================================================+

Yes, I found that one already, too.

And, oh joy, we have pseudos in REG_EQUAL notes after LRA! (Probably
also after reload, btw.).  In the ICE I got, a pseudo's live range got
split and an inheritance move is injected, but REG_EQUAL notes were
not updated or removed. Finding and removing the notes is hard in IRA
and LRA because they don't use the DF caches.

Ciao!
Steven

Patch

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;
                  }