https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125421
--- Comment #1 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
The heart of the issue is inconsistency in skipping(or not) of intermediate
types.
In dwarf2out.cc: modified_type_die () the code of convecn is
```
name = qualified_type ? TYPE_NAME (qualified_type) : NULL;
tree dtype = TREE_TYPE (name);
if (qualified_type == dtype && !reverse_type)
return modified_type_die (TREE_TYPE (origin), cv_quals, type_attrs,
reverse, context_die);
else
return modified_type_die (DECL_ORIGINAL_TYPE (name), cv_quals,
type_attrs, reverse, context_die);
```
get_qualified_type(u16, CONST) could return a qualified_type which is
semantically the same TYPE_NAME but with different pointer values which
would take the else arm and DECL_ORIGINAL_TYPE skips the current type "u16" and
goes to its parent "__u16".