]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/34415 (Possible miscompilation on MIPS)
authorRichard Sandiford <rsandifo@nildram.co.uk>
Sun, 16 Dec 2007 09:54:34 +0000 (09:54 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 16 Dec 2007 09:54:34 +0000 (09:54 +0000)
gcc/
PR rtl-optimization/34415
* df.h (DF_LR_IN, DF_LR_OUT): Update comments.
* resource.c (mark_target_live_regs): Use DF_LR_IN rather than
df_get_live_in.  Don't handle pseudos.

gcc/testsuite/
PR rtl-optimization/34415
* gcc.c-torture/execute/pr34415.c: New test.

From-SVN: r130987

gcc/ChangeLog
gcc/df.h
gcc/resource.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr34415.c [new file with mode: 0644]

index 054ef8f2caf4f413e54530574f57f9fbd4b0885f..4dac20691b7e6a3af58fcc498a06c1ea89f8a4c5 100644 (file)
@@ -1,3 +1,10 @@
+2007-12-16  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR rtl-optimization/34415
+       * df.h (DF_LR_IN, DF_LR_OUT): Update comments.
+       * resource.c (mark_target_live_regs): Use DF_LR_IN rather than
+       df_get_live_in.  Don't handle pseudos.
+
 2007-12-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/34003
index ba5f9b9e9b0247da1f1cccd3752fd79d62767e9d..04bac49bf0a19847bdf379a2cc93c543793557a6 100644 (file)
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -559,9 +559,9 @@ struct df
 #define DF_LIVE_IN(BB) (DF_LIVE_BB_INFO(BB)->in) 
 #define DF_LIVE_OUT(BB) (DF_LIVE_BB_INFO(BB)->out) 
 
-/* These macros are currently used by only reg-stack since it is not
-   tolerant of uninitialized variables.  This intolerance should be
-   fixed because it causes other problems.  */ 
+/* These macros are used by passes that are not tolerant of
+   uninitialized variables.  This intolerance should eventually
+   be fixed.  */
 #define DF_LR_IN(BB) (DF_LR_BB_INFO(BB)->in) 
 #define DF_LR_OUT(BB) (DF_LR_BB_INFO(BB)->out) 
 
index 7cb4d2ae490c02be67da4bab881e071e5e0ae8bf..2ffde4f8e6fe5b7518808f448ff80a573c68bf1e 100644 (file)
@@ -958,9 +958,8 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
      TARGET.  Otherwise, we must assume everything is live.  */
   if (b != -1)
     {
-      regset regs_live = df_get_live_in (BASIC_BLOCK (b));
+      regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
       rtx start_insn, stop_insn;
-      reg_set_iterator rsi;
 
       /* Compute hard regs live at start of block -- this is the real hard regs
         marked live, plus live pseudo regs that have been renumbered to
@@ -968,13 +967,6 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
 
       REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
 
-      EXECUTE_IF_SET_IN_REG_SET (regs_live, FIRST_PSEUDO_REGISTER, i, rsi)
-       {
-         if (reg_renumber[i] >= 0)
-           add_to_hard_reg_set (&current_live_regs, PSEUDO_REGNO_MODE (i),
-                               reg_renumber[i]);
-       }
-
       /* Get starting and ending insn, handling the case where each might
         be a SEQUENCE.  */
       start_insn = (b == ENTRY_BLOCK_PTR->next_bb->index ? 
index 3014120c2d1807bf624fd33216ef81b0b43760bf..06a2195d963bb76e4d493807223119b8c2b66a9f 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-16  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR rtl-optimization/34415
+       * gcc.c-torture/execute/pr34415.c: New test.
+
 2007-12-16  Danny Smith <dannysmith@users.sourceforge.net>
 
        * gcc.target/i386/fastcall-1.c: (f4): Change return type to
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34415.c b/gcc/testsuite/gcc.c-torture/execute/pr34415.c
new file mode 100644 (file)
index 0000000..ec75394
--- /dev/null
@@ -0,0 +1,34 @@
+const char *__attribute__((noinline))
+foo (const char *p)
+{
+  const char *end;
+  int len = 1;
+  for (;;)
+    {
+      int c = *p;
+      c = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
+      if (c == 'B')
+       end = p;
+      else if (c == 'A')
+       {
+         end = p;
+         do
+           p++;
+         while (*p == '+');
+       }
+      else
+       break;
+      p++;
+      len++;
+    }
+  if (len > 2 && *p == ':')
+    p = end;
+  return p;
+}
+
+int
+main (void)
+{
+  const char *input = "Bbb:";
+  return foo (input) != input + 2;
+}