aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-11-25 18:12:29 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-11-25 18:12:29 +0100
commit27d0862e62b5af5cce218a32cfcf3db27c85d1f2 (patch)
tree41c0096307a8386d29ee56f9b91319ef9abee866 /gcc
parentbe40f3cd82bf8a14dbfea17e554774ef2171fdc8 (diff)
downloadgcc-27d0862e62b5af5cce218a32cfcf3db27c85d1f2.zip
gcc-27d0862e62b5af5cce218a32cfcf3db27c85d1f2.tar.gz
gcc-27d0862e62b5af5cce218a32cfcf3db27c85d1f2.tar.bz2
re PR rtl-optimization/78527 (ice on valid C code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in smallest_mode_for_size, at stor-layout.c:364))
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
Diffstat (limited to 'gcc')
-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;
+ }
+}