This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ICE in vrp on aarch64 (PR tree-optimization/92452)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>, Jeff Law <law at redhat dot com>, Richard Sandiford <Richard dot Sandiford at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 11 Nov 2019 21:18:16 +0100
- Subject: [PATCH] Fix ICE in vrp on aarch64 (PR tree-optimization/92452)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The following testcase ICEs on aarch64-linux. The problem is that maxbound
is POLY_INT_CST, eltsize is INTEGER_CST, but int_const_binop for
TRUNC_DIV_EXPR returns NULL_TREE as it can't simplify it to something
usable and we later try to MINUS_EXPR the NULL_TREE.
Fixed thusly, tested using cross to aarch64-linux, bootstrapped/regtested on
powerpc64le-linux, ok for trunk?
2019-11-11 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92452
* tree-vrp.c (vrp_prop::check_array_ref): If TRUNC_DIV_EXPR folds
into NULL_TREE, set up_bound to NULL_TREE instead of computing
MINUS_EXPR on it.
* c-c++-common/pr92452.c: New test.
--- gcc/tree-vrp.c.jj 2019-11-09 00:41:09.022921760 +0100
+++ gcc/tree-vrp.c 2019-11-11 17:03:36.844669691 +0100
@@ -4150,8 +4150,11 @@ vrp_prop::check_array_ref (location_t lo
up_bound_p1 = int_const_binop (TRUNC_DIV_EXPR, maxbound, eltsize);
- up_bound = int_const_binop (MINUS_EXPR, up_bound_p1,
- build_int_cst (ptrdiff_type_node, 1));
+ if (up_bound_p1 != NULL_TREE)
+ up_bound = int_const_binop (MINUS_EXPR, up_bound_p1,
+ build_int_cst (ptrdiff_type_node, 1));
+ else
+ up_bound = NULL_TREE;
}
}
else
--- gcc/testsuite/c-c++-common/pr92452.c.jj 2019-11-11 17:06:01.525495277 +0100
+++ gcc/testsuite/c-c++-common/pr92452.c 2019-11-11 17:05:31.256950180 +0100
@@ -0,0 +1,5 @@
+/* PR tree-optimization/92452 */
+/* { dg-do compile } */
+/* { dg-options "-Os -Warray-bounds=1" } */
+
+#include "pr60101.c"
Jakub