re PR rtl-optimization/78527 (ice on valid C code at -O3 in both 32-bit and 64-bit...
authorJakub Jelinek <jakub@redhat.com>
Fri, 25 Nov 2016 17:12:29 +0000 (18:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 25 Nov 2016 17:12:29 +0000 (18:12 +0100)
PR rtl-optimization/78527
* combine.c (make_compound_operation_int): Ignore LSHIFTRT with
out of bounds shift count.

* gcc.c-torture/compile/pr78527.c: New test.

From-SVN: r242879

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr78527.c [new file with mode: 0644]

index 443dbfc77c30ad8b4d95f1af87f30872263ffa58..947f8f6d1ddbdb1aef3d2e42a8b7adef95812cd0 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/78527
+       * combine.c (make_compound_operation_int): Ignore LSHIFTRT with
+       out of bounds shift count.
+
 2016-11-25  Martin Liska  <mliska@suse.cz>
 
        PR web/71666
index ce6cfde534d3a5d8518a5d6c2f32760b10b762e5..ecf674193f7e36bf15da7baef383be440f2bbf58 100644 (file)
@@ -8091,6 +8091,8 @@ make_compound_operation_int (machine_mode mode, rtx *x_ptr,
        if (GET_CODE (inner) == LSHIFTRT
            && CONST_INT_P (XEXP (inner, 1))
            && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (inner))
+           && (UINTVAL (XEXP (inner, 1))
+               < GET_MODE_PRECISION (GET_MODE (inner)))
            && subreg_lowpart_p (x))
          {
            new_rtx = make_compound_operation (XEXP (inner, 0), next_code);
index 25663cefe0a0b0636a40d0e1e0cb6b8eee2ce672..a4f67e54d135c7f946ab3c09ac3de75341450ad4 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/78527
+       * gcc.c-torture/compile/pr78527.c: New test.
+
 2016-11-25  Martin Liska  <mliska@suse.cz>
 
        PR gcov-profile/78086
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78527.c b/gcc/testsuite/gcc.c-torture/compile/pr78527.c
new file mode 100644 (file)
index 0000000..d1bbdc4
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/78527 */
+
+unsigned a;
+short b, e;
+int *c;
+char d;
+
+int
+main ()
+{
+  int f = 80;
+  for (;;) {
+    if (f > 432)
+      *c = a;
+    while (b)
+      if (d)
+        e = -(a >> f);
+    c = &f;
+    b = e;
+  }
+}