https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120353
--- Comment #2 from qinzhao at gcc dot gnu.org --- the following patch fixes the issue: [opc@qinzhao-aarch64-ol8 c]$ git diff diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index ad66d7d258b..4733287eaf8 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -9891,6 +9891,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t); C_TYPE_VARIABLY_MODIFIED (x) = C_TYPE_VARIABLY_MODIFIED (t); C_TYPE_INCOMPLETE_VARS (x) = NULL_TREE; + TYPE_INCLUDES_FLEXARRAY (x) = TYPE_INCLUDES_FLEXARRAY (t); } /* Update type location to the one of the definition, instead of e.g.