]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: Fix bug in typedef redefinitions of tagged types [PR118765]
authorMartin Uecker <uecker@tugraz.at>
Sat, 1 Mar 2025 20:32:21 +0000 (21:32 +0100)
committerMartin Uecker <uecker@gcc.gnu.org>
Wed, 19 Mar 2025 07:53:12 +0000 (08:53 +0100)
commit1636e85270d918a84d57bb521c22c42abf42a47c
tree300f437b7e14fd0acaee6738f185c5c19f42090b
parentd9e834958e82219f836577da4ef8176aca2c7c9f
c: Fix bug in typedef redefinitions of tagged types [PR118765]

When we redefine a tagged type we incorrectly update TYPE_STUB_DECL
of the previously defined type instead of the new one.  Because
TYPE_STUB_DECL is used when determining whether two such types are
the same, this can cause valid typedef redefinitions to be rejected
later. This is only a partial fix for PR118765.

PR c/118765

gcc/c/ChangeLog:
* c-decl.cc (finish_struct,finish_enum): Swap direction when
copying TYPE_STRUB_DECL in redefinitions.

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