re PR debug/44028 (-fcompare-debug failure (length) with -O3 -fsched-pressure -fsched...
authorJakub Jelinek <jakub@redhat.com>
Mon, 10 May 2010 18:28:03 +0000 (20:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 10 May 2010 18:28:03 +0000 (20:28 +0200)
PR debug/44028
* haifa-sched.c (schedule_insn): When clearing INSN_VAR_LOCATION_LOC,
clear also INSN_REG_USE_LIST.

* gcc.dg/pr44028.c: New test.

From-SVN: r159240

gcc/ChangeLog
gcc/haifa-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr44028.c [new file with mode: 0644]

index 07f66dcc061c635a1f1b53becb6080b8ae6cf5a2..cd9b37493907454d2778e4a46d91f9f30e50ea8b 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/44028
+       * haifa-sched.c (schedule_insn): When clearing INSN_VAR_LOCATION_LOC,
+       clear also INSN_REG_USE_LIST.
+
 2010-05-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * config/mips/mips.c (TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P): Undef.
index b7f0cfce359ced98e1cfb5c4b4978f84cacabe8d..0dd220d7302a507355c7408209e78b0bbb0141f9 100644 (file)
@@ -1695,6 +1695,7 @@ schedule_insn (rtx insn)
         sd_iterator_cond (&sd_it, &dep);)
       {
        rtx dbg = DEP_PRO (dep);
+       struct reg_use_data *use, *next;
 
        gcc_assert (DEBUG_INSN_P (dbg));
 
@@ -1716,6 +1717,14 @@ schedule_insn (rtx insn)
        INSN_VAR_LOCATION_LOC (dbg) = gen_rtx_UNKNOWN_VAR_LOC ();
        df_insn_rescan (dbg);
 
+       /* Unknown location doesn't use any registers.  */
+       for (use = INSN_REG_USE_LIST (dbg); use != NULL; use = next)
+         {
+           next = use->next_insn_use;
+           free (use);
+         }
+       INSN_REG_USE_LIST (dbg) = NULL;
+
        /* We delete rather than resolve these deps, otherwise we
           crash in sched_free_deps(), because forward deps are
           expected to be released before backward deps.  */
index f54d9c4a8980d082e2a763495be94c9762d70f24..824920b41351283aa955d4dfe4083d608bcd526a 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/44028
+       * gcc.dg/pr44028.c: New test.
+
 2010-05-08  Daniel Franke  <franke.daniel@gmail.com>
 
        PR fortran/27866
diff --git a/gcc/testsuite/gcc.dg/pr44028.c b/gcc/testsuite/gcc.dg/pr44028.c
new file mode 100644 (file)
index 0000000..3345217
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR debug/44028 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug" } */
+/* { dg-options "-O3 -fsched-pressure -fschedule-insns -fcompare-debug" { target i?86-*-* x86_64-*-* } } */
+
+struct S { int val[16]; };
+
+static inline int
+bar (struct S x)
+{
+  long double pc = 0;
+  int i;
+  for (i = 0; i < 16; i++)
+    pc += x.val[i];
+  return pc;
+}
+
+int
+foo (struct S x)
+{
+  return bar (x);
+}