http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46796
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-10
14:32:48 UTC ---
The volatile qualified case happens because dwarf2out.c wants to emit an
unqualified variant first and gets at it via get_qualified_type which in
turn uses check_qualified_type to pick one from the list of variant types.
But as we never merge TYPE_DECLs we have different TYPE_NAMEs for the
qualified and unqualified variants:
(gdb) call debug_tree ($34)
<type_decl 0xb7758798 float
type <real_type 0xb7750900 float asm_written SF
size <integer_cst 0xb773f240 constant 32>
unit size <integer_cst 0xb773f078 constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32
pointer_to_this <pointer_type 0xb7750a20>>
VOID file (null) line 0 col 0
align 1>
(gdb) call debug_tree ($35)
<type_decl 0xb775857c float
type <real_type 0xb7750900 float asm_written SF
size <integer_cst 0xb773f240 constant 32>
unit size <integer_cst 0xb773f078 constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32
pointer_to_this <pointer_type 0xb7750a20>>
VOID file (null) line 0 col 0
align 1>
and thus get_qualified_type happily returns NULL which leads to
name being set to NULL even though the original type does
have a name in modified_type_die.
Now. We probably should start to merge TYPE_DECLs at some point,
even if it is only for memory use.
But instead of
/* This probably indicates a bug. */
else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
add_name_attribute (mod_type_die, "__unknown__");
we could use TYPE_NAME of the original type here, it will have no
qualifications anyway.