]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/43700 (global register variables defect)
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 29 May 2011 18:10:44 +0000 (18:10 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 29 May 2011 18:10:44 +0000 (18:10 +0000)
gcc/
PR target/43700
* config/mips/mips.c (mips_cfun_call_saved_reg_p): Handle global
registers.

gcc/testsuite/
* gcc.target/mips/reg-var-1.c: New test.

From-SVN: r174409

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/reg-var-1.c [new file with mode: 0644]

index be398a1eecbd9106c1eb42e64c0258f235302469..d4d5074a833f5f3f37c47014a41a277107e19d82 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-29  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR target/43700
+       * config/mips/mips.c (mips_cfun_call_saved_reg_p): Handle global
+       registers.
+
 2011-05-25  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/49133
index 2c19c1c307e5ef9065348ba4198650254c38e2ab..c6654f726d2c29973645d4cc257b6a7efba63266 100644 (file)
@@ -8495,7 +8495,7 @@ mips_cfun_call_saved_reg_p (unsigned int regno)
      property here.  */
   return (regno == GLOBAL_POINTER_REGNUM
          ? TARGET_CALL_SAVED_GP
-         : !call_really_used_regs[regno]);
+         : !global_regs[regno] && !call_really_used_regs[regno]);
 }
 
 /* Return true if the function body might clobber register REGNO.
index bf33fc076d945ffd2afd68e25a772d6a348c6264..5b8dc062494c2996573b4ee5ec89e64dad31522d 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-29  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * gcc.target/mips/reg-var-1.c: New test.
+
 2011-05-25  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/49133
diff --git a/gcc/testsuite/gcc.target/mips/reg-var-1.c b/gcc/testsuite/gcc.target/mips/reg-var-1.c
new file mode 100644 (file)
index 0000000..d8b8118
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+register int g asm ("$18");
+
+void __attribute__((noinline))
+test (void)
+{
+  g = g + 1;
+}
+
+int
+main (void)
+{
+  g = 2;
+  test ();
+  return g != 3;
+}