summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2011-12-05 16:11:35 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2011-12-05 16:11:35 +0000
commit100ed614f49dc076ce55c695398a0aa41bbd9b75 (patch)
tree80d9c8c64e201a8f16cedc97c992406cb04a51f2 /gcc
parentc4ce224c4b344c31347e526a4f8825c4daa414bd (diff)
downloadgcc-100ed614f49dc076ce55c695398a0aa41bbd9b75.tar.gz
re PR target/51408 (Miscompilation in arm.md:*minmax_arithsi)
gcc/ PR target/51408 * config/arm/arm.md (*minmax_arithsi): Always require the else clause in the MINUS case. gcc/testsuite/ PR target/51408 * gcc.dg/pr51408.c: New. From-SVN: r182014
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/arm/arm.md2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr51408.c22
4 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 34d55bb0cae..9e3bce6cc2e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50904
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 8ec9b2288bb..6493a791a4a 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -3413,7 +3413,7 @@
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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dcc8226acdd..c8556570130 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-05 Kazu Hirata <kazu@codesourcery.com>
+
+ PR target/51408
+ * gcc.dg/pr51408.c: New.
+
2011-12-05 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/dc6.C: New.
diff --git a/gcc/testsuite/gcc.dg/pr51408.c b/gcc/testsuite/gcc.dg/pr51408.c
new file mode 100644
index 00000000000..2cc5cf967b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr51408.c
@@ -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;
+}