]> 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>
Wed, 30 Jul 2025 14:49:12 +0000 (14:49 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Wed, 30 Jul 2025 14:49:12 +0000 (14:49 +0000)
commit722aa418df94d85eecb7500ec9c38384c557338d
tree34de21bf4c242c35d3e843f6bd3772eac5204894
parent12796e6938a6390512e714f635d2c4fdef7023ba
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.

(cherry picked from commit 70418e6c0120cfce33ab69628602dfdadbed683a)
gcc/c/c-decl.cc
gcc/testsuite/gcc.dg/pr120354.c [new file with mode: 0644]