https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118765
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Martin Uecker <uec...@gcc.gnu.org>: https://gcc.gnu.org/g:1636e85270d918a84d57bb521c22c42abf42a47c commit r15-8287-g1636e85270d918a84d57bb521c22c42abf42a47c Author: Martin Uecker <uec...@tugraz.at> Date: Sat Mar 1 21:32:21 2025 +0100 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.