From 6aa1abe5f29491a70fda964f13427a82fd65df95 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 25 May 2016 11:10:16 +0200 Subject: [PATCH] re PR tree-optimization/71239 (ICE in operand_equal_p (fold-const.c:2769)) Fix PR tree-optimization/71239. * g++.dg/pr71239.C: New test. PR tree-optimization/71239 * tree.c (array_at_struct_end_p): Do not call operand_equal_p if DECL_SIZE is NULL. From-SVN: r236696 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/tree.c | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 10b423587bf..cad9dab8cbc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-25 Martin Liska + + PR tree-optimization/71239 + * tree.c (array_at_struct_end_p): Do not call operand_equal_p + if DECL_SIZE is NULL. + 2016-05-25 Richard Biener * timevar.def (TV_TREE_LOOP_IFCVT): Add. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f670a902a08..d7a59ad54ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-05-25 Martin Liska + + * g++.dg/pr71239.C: New test. + 2016-05-25 Richard Biener * gcc/testsuite/gcc.dg/vect/pr58135.c: Rename to ... diff --git a/gcc/tree.c b/gcc/tree.c index 83dc7d8bc90..f4b470b3ce8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -13097,7 +13097,8 @@ array_at_struct_end_p (tree ref) is valid because BUF allocate enough space. */ - && (!size || operand_equal_p (DECL_SIZE (ref), size, 0)) + && (!size || (DECL_SIZE (ref) != NULL + && operand_equal_p (DECL_SIZE (ref), size, 0))) && !(flag_unconstrained_commons && TREE_CODE (ref) == VAR_DECL && DECL_COMMON (ref))) return false; -- 2.30.2