]> git.ipfire.org Git - thirdparty/gcc.git/commit
C: Flex array in the middle via type alias is not reported [PR120353]
authorQing Zhao <qing.zhao@oracle.com>
Wed, 28 May 2025 21:13:38 +0000 (21:13 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Fri, 30 May 2025 15:18:26 +0000 (15:18 +0000)
commitf37c5f1d88c9da17f16cdb33e7c9d43e4bb5f64d
tree1f12b17ea06c928a5d1860b742d1e5990ccdd462
parent28a17985dd34b7ad154c6fcd399ce10616db7a92
C: Flex array in the middle via type alias is not reported [PR120353]

The root cause of the bug is: the TYPE_INCLUDES_FLEXARRAY marking of the
structure type is not copied to its aliased type.
The fix is to copy this marking to all the variant types of the current
structure type.

PR c/120353

gcc/c/ChangeLog:

* c-decl.cc (finish_struct): Copy TYPE_INCLUDES_FLEXARRAY marking
to all the variant types of the current structure type.

gcc/testsuite/ChangeLog:

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