aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-11-25 20:24:22 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-11-25 20:24:22 +0100
commit8382457c0f7cbb4b0b5b7e700f15c47b2d6d8d6c (patch)
tree1d38e9b033a7bb7df9f65c4be64b8ad46a634dd0 /gcc/testsuite/gcc.c-torture
parentad7a69db52391cf141d0f6da6042a5fc7d8d54c3 (diff)
downloadgcc-8382457c0f7cbb4b0b5b7e700f15c47b2d6d8d6c.zip
gcc-8382457c0f7cbb4b0b5b7e700f15c47b2d6d8d6c.tar.gz
gcc-8382457c0f7cbb4b0b5b7e700f15c47b2d6d8d6c.tar.bz2
re PR rtl-optimization/78438 (incorrect comparison optimization)
PR rtl-optimization/78438 PR rtl-optimization/78477 * gcc.c-torture/execute/pr78438.c: New test. * gcc.c-torture/execute/pr78477.c: New test. From-SVN: r242883
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr78438.c22
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr78477.c27
2 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr78438.c b/gcc/testsuite/gcc.c-torture/execute/pr78438.c
new file mode 100644
index 0000000..3383c32
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr78438.c
@@ -0,0 +1,22 @@
+/* PR target/78438 */
+
+char a = 0;
+int b = 197412621;
+
+__attribute__ ((noinline, noclone))
+void foo ()
+{
+ a = 0 > (short) (b >> 11);
+}
+
+int
+main ()
+{
+ asm volatile ("" : : : "memory");
+ if (__CHAR_BIT__ != 8 || sizeof (short) != 2 || sizeof (int) < 4)
+ return 0;
+ foo ();
+ if (a != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr78477.c b/gcc/testsuite/gcc.c-torture/execute/pr78477.c
new file mode 100644
index 0000000..62e894e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr78477.c
@@ -0,0 +1,27 @@
+/* PR rtl-optimization/78477 */
+
+unsigned a;
+unsigned short b;
+
+unsigned
+foo (unsigned x)
+{
+ b = x;
+ a >>= (b & 1);
+ b = 1 | (b << 5);
+ b >>= 15;
+ x = (unsigned char) b > ((2 - (unsigned char) b) & 1);
+ b = 0;
+ return x;
+}
+
+int
+main ()
+{
+ if (__CHAR_BIT__ != 8 || sizeof (short) != 2 || sizeof (int) < 4)
+ return 0;
+ unsigned x = foo (12345);
+ if (x != 0)
+ __builtin_abort ();
+ return 0;
+}