]> git.ipfire.org Git - thirdparty/gcc.git/commit
C: Flex array in union followed by a structure field is not reported [PR120354]
authorQing Zhao <qing.zhao@oracle.com>
Thu, 29 May 2025 15:59:41 +0000 (15:59 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Fri, 30 May 2025 15:18:35 +0000 (15:18 +0000)
commit70418e6c0120cfce33ab69628602dfdadbed683a
tree1e9959ec629493dccc9388a7d9e7cd772dad3b4a
parentf37c5f1d88c9da17f16cdb33e7c9d43e4bb5f64d
C: Flex array in union followed by a structure field is not reported [PR120354]

There is only one last_field for a structure type, but there might
be multiple last_fields for a union type, therefore we should ORed
the result of TYPE_INCLUDES_FLEXARRAY for multiple last_fields of
a union type.

PR c/120354

gcc/c/ChangeLog:

* c-decl.cc (finish_struct): Or the results for TYPE_INCLUDES_FLEXARRAY.

gcc/testsuite/ChangeLog:

* gcc.dg/pr120354.c: New test.
gcc/c/c-decl.cc
gcc/testsuite/gcc.dg/pr120354.c [new file with mode: 0644]