re PR tree-optimization/71239 (ICE in operand_equal_p (fold-const.c:2769))
authorMartin Liska <mliska@suse.cz>
Wed, 25 May 2016 09:10:16 +0000 (11:10 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 25 May 2016 09:10:16 +0000 (09:10 +0000)
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
gcc/testsuite/ChangeLog
gcc/tree.c

index 10b423587bf35520ce3c1d38dbdcf942c1ac0798..cad9dab8cbc6032fd9cd93380a122a20e20de9db 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-25  Martin Liska  <mliska@suse.cz>
+
+       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  <rguenther@suse.de>
 
        * timevar.def (TV_TREE_LOOP_IFCVT): Add.
index f670a902a08086492cdc69c32b1b340987f274c5..d7a59ad54cec88a798f42910b645a37a8ae571a5 100644 (file)
@@ -1,3 +1,7 @@
+2016-05-25  Martin Liska  <mliska@suse.cz>
+
+       * g++.dg/pr71239.C: New test.
+
 2016-05-25  Richard Biener  <rguenther@suse.de>
 
        * gcc/testsuite/gcc.dg/vect/pr58135.c: Rename to ...
index 83dc7d8bc900dab744157517b7b2a664c70a76ff..f4b470b3ce84e15a68dde3a492141f6936e327d9 100644 (file)
@@ -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;