diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-12 09:21:40 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-11-12 09:21:40 +0100 |
commit | e4722b81a45e797565b700d1a5af9b66ae56adf0 (patch) | |
tree | afca8a60120ba3f8af9af6fe3a43ac4edf18c4f5 | |
parent | f03099371687f3f087e4949a68daccf76c8d18bc (diff) | |
download | gcc-e4722b81a45e797565b700d1a5af9b66ae56adf0.zip gcc-e4722b81a45e797565b700d1a5af9b66ae56adf0.tar.gz gcc-e4722b81a45e797565b700d1a5af9b66ae56adf0.tar.bz2 |
re PR tree-optimization/92452 (ICE in vrp_prop::check_array_ref at tree-vrp.c:4153)
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.
From-SVN: r278080
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr92452.c | 5 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 7 |
4 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77ede4d..39c9f6f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-11-12 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. + 2019-11-12 Andre Vieira <andre.simoesdiasvieira@arm.com> * tree-vect-loop.c (vect_transform_loop): Don't overwrite epilogues diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ef92af..2196bf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/92452 + * c-c++-common/pr92452.c: New test. + 2019-11-12 Andre Vieira <andre.simoesdiasvieira@arm.com> * gcc.dg/vect/pr92347.c: New test. diff --git a/gcc/testsuite/c-c++-common/pr92452.c b/gcc/testsuite/c-c++-common/pr92452.c new file mode 100644 index 0000000..8c12b67 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr92452.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/92452 */ +/* { dg-do compile } */ +/* { dg-options "-Os -Warray-bounds=1" } */ + +#include "pr60101.c" diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index b8b6967..da11dfb 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -4150,8 +4150,11 @@ vrp_prop::check_array_ref (location_t location, tree ref, 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 |