[Bug tree-optimization/106457] array_at_struct_end_p returns TRUE for a two-dimension array which is not inside any structure

qinzhao at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 4 17:59:57 GMT 2022


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

--- Comment #6 from qinzhao at gcc dot gnu.org ---
the following patch fixed the issue:

[opc@qinzhao-aarch64-ol8 gcc]$ git diff tree.cc
diff --git a/gcc/tree.cc b/gcc/tree.cc
index fed1434d141d..d04ac121765a 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -12779,7 +12779,7 @@ array_at_struct_end_p (tree ref)
       && TREE_CODE (DECL_SIZE_UNIT (ref)) == INTEGER_CST)
     {
       /* If the object itself is the array it is not at struct end.  */
-      if (DECL_P (ref_to_array))
+      if (TREE_CODE (TREE_TYPE (ref)) == ARRAY_TYPE)
        return false;

       /* Check whether the array domain covers all of the available


More information about the Gcc-bugs mailing list