]> git.ipfire.org Git - thirdparty/gcc.git/commit
testsuite: Fix struct size check [PR116155]
authorDimitar Dimitrov <dimitar@dinux.eu>
Mon, 5 Aug 2024 16:00:28 +0000 (19:00 +0300)
committerDimitar Dimitrov <dimitar@dinux.eu>
Tue, 13 Aug 2024 20:57:58 +0000 (23:57 +0300)
commitb13e34699c7d27e561fcfe1b66ced1e50e69976f
tree3eb07e8e0c745163bd7725a6d6eba50f084eb3cc
parentcc00a737e840986f4916918759ba214a95ae6888
testsuite: Fix struct size check [PR116155]

The size of "struct only_fam_2" is dependent on the alignment of the
flexible array member "b", and not on the type of the preceding
bit-fields.  For most targets the two are equal.  But on default_packed
targets like pru-unknown-elf, the alignment of int is not equal to the
size of int, so the test failed.

Patch was suggested by Qing Zhao.  Tested on pru-unknown-elf and
x86_64-pc-linux-gnu.

PR testsuite/116155

gcc/testsuite/ChangeLog:

* c-c++-common/fam-in-union-alone-in-struct-1.c: Adjust
check to account for default_packed targets.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-1.c