Hi!

In order to close these 2 PRs fixed recently by Segher, I've added the
corresponding tests and am going to close them as fixed.

2016-11-25  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/78438
        PR rtl-optimization/78477
        * gcc.c-torture/execute/pr78438.c: New test.
        * gcc.c-torture/execute/pr78477.c: New test.

--- gcc/testsuite/gcc.c-torture/execute/pr78438.c.jj    2016-11-25 
20:17:29.448019008 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr78438.c       2016-11-25 
20:17:05.000000000 +0100
@@ -0,0 +1,22 @@
+/* PR rtl-optimization/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;
+}
--- gcc/testsuite/gcc.c-torture/execute/pr78477.c.jj    2016-11-25 
20:20:26.593705268 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr78477.c       2016-11-25 
20:20:14.000000000 +0100
@@ -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;
+}

        Jakub

Reply via email to