https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102195
Bug ID: 102195
Summary: Missing DW_TAG_typedef when using qualified variable
of typedef'd array
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: ibhagatgnu at gmail dot com
Target Milestone: ---
$ cat typedef1.c
typedef int A[2][3];
const A a = {{4, 5, 6}, {7, 8, 9}};
$ gcc -g -c typedef1.c
$ objdump --dwarf=info typedef1.o
<1><1e>: Abbrev Number: 3 (DW_TAG_array_type)
<1f> DW_AT_type : <0x40>
<23> DW_AT_sibling : <0x34>
<2><27>: Abbrev Number: 1 (DW_TAG_subrange_type)
<28> DW_AT_type : <0x39>
<2c> DW_AT_upper_bound : 1
<2><2d>: Abbrev Number: 1 (DW_TAG_subrange_type)
<2e> DW_AT_type : <0x39>
<32> DW_AT_upper_bound : 2
<2><33>: Abbrev Number: 0
<1><34>: Abbrev Number: 4 (DW_TAG_const_type)
<35> DW_AT_type : <0x1e>
<1><39>: Abbrev Number: 5 (DW_TAG_base_type)
<3a> DW_AT_byte_size : 8
<3b> DW_AT_encoding : 7 (unsigned)
<3c> DW_AT_name : (indirect string, offset: 0x52): long unsigned
int
<1><40>: Abbrev Number: 6 (DW_TAG_base_type)
<41> DW_AT_byte_size : 4
<42> DW_AT_encoding : 5 (signed)
<43> DW_AT_name : int
<1><47>: Abbrev Number: 7 (DW_TAG_variable)
<48> DW_AT_name : a
<4a> DW_AT_decl_file : 1
<4b> DW_AT_decl_line : 2
<4c> DW_AT_decl_column : 9
<4d> DW_AT_type : <0x34>
<51> DW_AT_external : 1
<51> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0)
<1><5b>: Abbrev Number: 0
If typedef'd type is a base type / struct, DW_TAG_typedef shows up.
$ cat typedef3.c
typedef struct foo
{
int a;
int b;
} bar;
const bar ba;
$ objdump --dwarf=info typedef3.o
<1><1e>: Abbrev Number: 3 (DW_TAG_structure_type)
<1f> DW_AT_name : foo
<23> DW_AT_byte_size : 8
<24> DW_AT_decl_file : 1
<25> DW_AT_decl_line : 1
<26> DW_AT_decl_column : 16
<27> DW_AT_sibling : <0x3e>
<2><2b>: Abbrev Number: 1 (DW_TAG_member)
<2c> DW_AT_name : a
<2e> DW_AT_decl_file : 1
<2e> DW_AT_decl_line : 3
<2f> DW_AT_decl_column : 7
<2f> DW_AT_type : <0x3e>
<33> DW_AT_data_member_location: 0
<2><34>: Abbrev Number: 1 (DW_TAG_member)
<35> DW_AT_name : b
<37> DW_AT_decl_file : 1
<37> DW_AT_decl_line : 4
<38> DW_AT_decl_column : 7
<38> DW_AT_type : <0x3e>
<3c> DW_AT_data_member_location: 4
<2><3d>: Abbrev Number: 0
<1><3e>: Abbrev Number: 4 (DW_TAG_base_type)
<3f> DW_AT_byte_size : 4
<40> DW_AT_encoding : 5 (signed)
<41> DW_AT_name : int
<1><45>: Abbrev Number: 5 (DW_TAG_typedef)
<46> DW_AT_name : bar
<4a> DW_AT_decl_file : 1
<4b> DW_AT_decl_line : 5
<4c> DW_AT_decl_column : 3
<4d> DW_AT_type : <0x1e>
<1><51>: Abbrev Number: 6 (DW_TAG_const_type)
<52> DW_AT_type : <0x45>
<1><56>: Abbrev Number: 7 (DW_TAG_variable)
<57> DW_AT_name : ba
<5a> DW_AT_decl_file : 1
<5b> DW_AT_decl_line : 6
<5c> DW_AT_decl_column : 11
<5d> DW_AT_type : <0x51>
<61> DW_AT_external : 1
<61> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0)
<1><6b>: Abbrev Number: 0