]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713...
authorMartin Uecker <uecker@tugraz.at>
Sat, 23 Nov 2024 07:04:05 +0000 (08:04 +0100)
committerMartin Uecker <uecker@gcc.gnu.org>
Sun, 30 Mar 2025 09:56:06 +0000 (11:56 +0200)
commit73549be0a3c819b2ab78e0e973f5b4d41b9f4a2d
tree549cee6ca0ab5c5ba104d6a49ad986ee52005949
parent450dc448eabaaf14a3401788028049b27991213c
Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713,PR117724]

For checking or computing TYPE_CANONICAL, ignore the array size when it is
the last element of a structure or union.  To not get errors because of
an inconsistent number of members, zero-sized arrays which are the last
element are not ignored anymore when checking the fields of a struct.

PR c/113688
PR c/114014
PR c/114713
PR c/117724

gcc/ChangeLog:
* tree.cc (gimple_canonical_types_compatible_p): Add exception.

gcc/lto/ChangeLog:
* lto-common.cc (hash_canonical_type): Add exception.

gcc/testsuite/ChangeLog:
* gcc.dg/pr113688.c: New test.
* gcc.dg/pr114014.c: New test.
* gcc.dg/pr114713.c: New test.
* gcc.dg/pr117724.c: New test.

(cherry picked from commit d46c7f313b5a30ee04080f249e31e12987d50aa2)
gcc/lto/lto-common.cc
gcc/testsuite/gcc.dg/pr113688.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr114014.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr114713.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr117724.c [new file with mode: 0644]
gcc/tree.cc