https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128441
--- Comment #1 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
This is related to PR debug/125421 but not really a regression or result
thereof.
The duplicate predates the fix for PR debug/125421. Before that fix a
variant node always cloned the typedef, tagged or not.
r17-1810-g3e2885588fe0 ("dwarf: fix inconsistency in type chains
traversal [PR125421]") made such a variant reuse the typedef that names
it instead of cloning, which removed the duplicate for the untagged
case. It deliberately excluded variants carrying a btf_type_tag:
/* Pointer identity check above might fail when qualified_type
is a different variant node of the same typedef yet requires
the same handling as if they matched (see PR/125421).
Skip this when btf_type_tag attributes are present, as those
need to be handled in the else branch below. */
|| (TYPE_NAME (qualified_type) == name
&& TYPE_QUALS (qualified_type) == TYPE_QUALS (dtype)
&& !lookup_attribute ("btf_type_tag", type_attrs))
so for tagged variants the old cloning path, and the duplicate, remain.
That exclusion exists on trunk and on releases/gcc-16 (backported as
49711a94ef6e, which lands after the gcc-16.2.0 tag).