]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: fix checking ICE related to transparent unions and atomic [PR123309]
authorMartin Uecker <uecker@tugraz.at>
Tue, 13 Jan 2026 18:09:53 +0000 (19:09 +0100)
committerMartin Uecker <uecker@gcc.gnu.org>
Tue, 13 Jan 2026 19:32:56 +0000 (20:32 +0100)
commite2acc3d38e800f8dd1f45f5ae6bf2ee090044bcf
treeff183138e6d5108d3953e626e6da9280e1cd410d
parent76ad28b11266606fcc1571d0ef92d3f2ef402bfb
c: fix checking ICE related to transparent unions and atomic [PR123309]

When matching function arguments in composite_type_internal and one
type comes from a transparent union, it is possible to end up with
atomic and non-atomic types because this case is not handled correctly.
The type matching logic is rewritten in a cleaner way to use helper
functions and to not walk the argument lists three times.  With this
change, a checking assertion can be added to test for matching qualifiers
for pointers. (In general, this assumption is still violated for
function return types.)

PR c/123309

gcc/c/ChangeLog:
* c-typeck.cc (transparent_union_replacement): New function.
(composite_type_internal): Rewrite logic.
(type_lists_compatible_p): Remove dead code for NULL arguments.

gcc/testsuite/ChangeLog:
* gcc.dg/pr123309.c: New test.
* gcc.dg/union-composite-type.c: New test.
gcc/c/c-typeck.cc
gcc/testsuite/gcc.dg/pr123309.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/union-composite-type.c [new file with mode: 0644]