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