]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/51408 (Miscompilation in arm.md:*minmax_arithsi)
authorKazu Hirata <kazu@codesourcery.com>
Fri, 9 Dec 2011 01:27:01 +0000 (01:27 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Fri, 9 Dec 2011 01:27:01 +0000 (01:27 +0000)
gcc/
Backport from mainline:

2011-12-05  Kazu Hirata  <kazu@codesourcery.com>

PR target/51408
* config/arm/arm.md (*minmax_arithsi): Always require the else
clause in the MINUS case.

testsuite/
Backport from mainline:

2011-12-05  Kazu Hirata  <kazu@codesourcery.com>

PR target/51408
* gcc.dg/pr51408.c: New.

From-SVN: r182149

gcc/ChangeLog
gcc/config/arm/arm.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr51408.c [new file with mode: 0644]

index f5ebe75f1b43241f74aa19e3acd79bf1c71e4916..fd2e56e815aaa2740764d1189385d33e1eee03a5 100644 (file)
@@ -1,3 +1,13 @@
+2011-12-09  Kazu Hirata  <kazu@codesourcery.com>
+
+       Backport from mainline:
+
+       2011-12-05  Kazu Hirata  <kazu@codesourcery.com>
+
+       PR target/51408
+       * config/arm/arm.md (*minmax_arithsi): Always require the else
+       clause in the MINUS case.
+
 2011-12-08  Teresa Johnson  <tejohnson@google.com>
 
        Backport from mainline:
index cc6d34be2c6f89b01d9df5e49d9f45e2ad48cc7f..794b865438c84a1822d5c6662476045b5cbbbe54 100644 (file)
     bool need_else;
 
     if (which_alternative != 0 || operands[3] != const0_rtx
-        || (code != PLUS && code != MINUS && code != IOR && code != XOR))
+        || (code != PLUS && code != IOR && code != XOR))
       need_else = true;
     else
       need_else = false;
index 1d94277b83400324b16ecf2424f43a282ddaba6e..0db1d35719be2d0c527bade7c46be83db5b61458 100644 (file)
@@ -1,3 +1,12 @@
+2011-12-09  Kazu Hirata  <kazu@codesourcery.com>
+
+       Backport from mainline:
+
+       2011-12-05  Kazu Hirata  <kazu@codesourcery.com>
+
+       PR target/51408
+       * gcc.dg/pr51408.c: New.
+
 2011-12-08  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51448
diff --git a/gcc/testsuite/gcc.dg/pr51408.c b/gcc/testsuite/gcc.dg/pr51408.c
new file mode 100644 (file)
index 0000000..2cc5cf9
--- /dev/null
@@ -0,0 +1,22 @@
+/* This testcase used to fail because of a bug in 
+   arm.md:*minmax_arithsi.  */
+
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+extern void abort (void);
+
+int __attribute__((noinline))
+foo (int a, int b)
+{
+  int max = (b > 0) ? b : 0;
+  return max - a;
+}
+
+int
+main (void)
+{
+  if (foo (3, -1) != -3)
+    abort ();
+  return 0;
+}