aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr78527.c21
4 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 443dbfc..947f8f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/combine.c b/gcc/combine.c
index ce6cfde..ecf6741 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 25663ce..a4f67e5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..d1bbdc4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78527.c
@@ -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;
+ }
+}