This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/61132] New: bad DWARF for VLA in the middle of a struct
- From: "tromey at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 May 2014 20:11:02 +0000
- Subject: [Bug debug/61132] New: bad DWARF for VLA in the middle of a struct
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61132
Bug ID: 61132
Summary: bad DWARF for VLA in the middle of a struct
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: tromey at gcc dot gnu.org
Consider this source:
void f(int n)
{
struct s { int before; int vla[n]; int after; } sv;
}
This uses the GNU extension of a VLA in the middle of a structure.
The DWARF generated for this is odd and not very useful to gdb.
First, the size of the struct type is weird:
<2><55>: Abbrev Number: 4 (DW_TAG_structure_type)
<56> DW_AT_name : s
<58> DW_AT_byte_size : 0xffffffff
<5c> DW_AT_decl_file : 1
<5d> DW_AT_decl_line : 3
<5e> DW_AT_sibling : <0x87>
Second, the location of the "after" member is wrong:
<3><7a>: Abbrev Number: 5 (DW_TAG_member)
<7b> DW_AT_name : (indirect string, offset: 0x4b): after
<7f> DW_AT_decl_file : 1
<80> DW_AT_decl_line : 3
<81> DW_AT_type : <0x97>
<85> DW_AT_data_member_location: 0