]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
200x-xx-xx Kaz Kylheku <kaz@zeugmasystems.com>
authorRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 19 Dec 2007 10:04:28 +0000 (10:04 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 19 Dec 2007 10:04:28 +0000 (10:04 +0000)
gcc/
200x-xx-xx  Kaz Kylheku  <kaz@zeugmasystems.com>

PR rtl-optimization/34456
* resource.c (mark_set_resources): Use regs_invalidated_by_call
rather than call_used_regs and global_regs.

gcc/testsuite/
PR rtl-optimization/34456
* gcc.c-torture/execute/pr34456.c: New test.

From-SVN: r131057

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

index 3ed2a6f9efd788e6024b6b1e00e37b95f5ed2bb7..35d60e88ae7d434a661d36c0c381dca93a5bfa5c 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-19  Kaz Kylheku  <kaz@zeugmasystems.com>
+
+       PR rtl-optimization/34456
+       * resource.c (mark_set_resources): Use regs_invalidated_by_call
+       rather than call_used_regs and global_regs.
+
 2007-12-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/34003
index ba2bd72f6fa1851d40028dbf58e1d721059448a6..8ba2abc0161bd96eca2065ad2c2f5e4c45c83216 100644 (file)
@@ -663,9 +663,8 @@ mark_set_resources (rtx x, struct resources *res, int in_dest,
          rtx link;
 
          res->cc = res->memory = 1;
-         for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
-           if (call_used_regs[r] || global_regs[r])
-             SET_HARD_REG_BIT (res->regs, r);
+
+         IOR_HARD_REG_SET (res->regs, regs_invalidated_by_call);
 
          for (link = CALL_INSN_FUNCTION_USAGE (x);
               link; link = XEXP (link, 1))
index 01034d03288fcfc916dfd1ef35b5a0386aae8d41..31e64187ebd9a92fd51be870bebc34d0dd8e1834 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-19  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       PR rtl-optimization/34456
+       * gcc.c-torture/execute/pr34456.c: New test.
+
 2007-12-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/34003
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34456.c b/gcc/testsuite/gcc.c-torture/execute/pr34456.c
new file mode 100644 (file)
index 0000000..526c954
--- /dev/null
@@ -0,0 +1,30 @@
+#include <stdlib.h>
+
+int __attribute__ ((noinline)) debug (void) { return 1; }
+int errors;
+
+struct s { int elt; int (*compare) (int); };
+
+static int
+compare (const void *x, const void *y)
+{
+  const struct s *s1 = x, *s2 = y;
+  int (*compare1) (int);
+  int elt2;
+
+  compare1 = s1->compare;
+  elt2 = s2->elt;
+  if (elt2 != 0 && debug () && compare1 (s1->elt) != 0)
+    errors++;
+  return compare1 (elt2);
+}
+
+int bad_compare (int x) { return -x; }
+struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } };
+
+int
+main (void)
+{
+  qsort (array, 2, sizeof (struct s), compare);
+  return errors == 0;
+}