https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118765

--- Comment #20 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:accbc1b90bd942aa36ac1485a21056b774ce02df

commit r15-8963-gaccbc1b90bd942aa36ac1485a21056b774ce02df
Author: Martin Uecker <uec...@tugraz.at>
Date:   Sun Mar 16 10:54:17 2025 +0100

    c: Fix tagname confusion for typedef redefinitions [PR118765]

    When we redefine a typedef for a tagged type that has just been
    redefined, merge_decls may produce invalid TYPE_DECLS that are not
    consistent with what set_underlying_type produces.  This is fixed
    by updating DECL_ORIGINAL_TYPE.

            PR c/118765

    gcc/c/ChangeLog:
            * c-decl.cc (merge_decls): For TYPE_DECLS copy
            DECL_ORIGINAL_TYPE from the old declaration.
            * c-typeck.cc (tagged_types_tu_compatible_p): Add
            checking assertions.

    gcc/testsuite/ChangeLog:
            * gcc.dg/pr118765-2.c: New test.
            * gcc.dg/pr118765-3.c: New test.
            * gcc.dg/typedef-redecl3.c: New test.

Reply via email to