[Bug tree-optimization/99121] [9/10/11 Regression] ICE tree check: expected integer_cst, have var_decl in get_len, at tree.h:6037

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 19 11:58:25 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99121

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
But easily fixed with sth like

diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc
index 199d9f5d216..b1179518651 100644
--- a/gcc/gimple-array-bounds.cc
+++ b/gcc/gimple-array-bounds.cc
@@ -607,6 +607,8 @@ array_bounds_checker::check_mem_ref (location_t location,
tree ref,

       if (TREE_CODE (reftype) == ARRAY_TYPE)
        {
+         if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (reftype))) != INTEGER_CST)
+           return false;
          /* Set to the size of the array element (and adjust below).  */
          eltsize = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (reftype)));
          /* Use log2 of size to convert the array byte size in to its

no?


More information about the Gcc-bugs mailing list