This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/43762] New: VLA artificial length var loclist is missing DW_OP_stack_value
- From: "jan dot kratochvil at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Apr 2010 21:47:54 -0000
- Subject: [Bug debug/43762] New: VLA artificial length var loclist is missing DW_OP_stack_value
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc (GCC) 4.6.0 20100415 (experimental)
-O2 -g
-----------------------------------------------------------------------------
void __attribute__((noinline))
f (int l)
{
char s[l];
}
int
main (void)
{
f (5);
return 0;
}
-----------------------------------------------------------------------------
<2><63>: Abbrev Number: 5 (DW_TAG_variable)
<64> DW_AT_name : s
<68> DW_AT_type : <0x74>
<1><74>: Abbrev Number: 7 (DW_TAG_array_type)
<2><7d>: Abbrev Number: 8 (DW_TAG_subrange_type)
<82> DW_AT_upper_bound : <0x59>
<2><59>: Abbrev Number: 4 (DW_TAG_variable)
<5a> DW_AT_artificial : 1
<5b> DW_AT_type : <0x8a>
<5f> DW_AT_location : 0x83 (location list)
<1><8a>: Abbrev Number: 10 (DW_TAG_const_type)
<8b> DW_AT_type : <0x87>
<1><87>: Abbrev Number: 9 (DW_TAG_base_type)
<88> DW_AT_byte_size : 8
<89> DW_AT_encoding : 7 (unsigned)
<2><4c>: Abbrev Number: 3 (DW_TAG_formal_parameter)
<4d> DW_AT_name : l
<51> DW_AT_type : <0x6d>
<55> DW_AT_location : 0x60 (location list)
<1><6d>: Abbrev Number: 6 (DW_TAG_base_type)
<6e> DW_AT_byte_size : 4
<6f> DW_AT_encoding : 5 (signed)
<70> DW_AT_name : int
Contents of the .debug_loc section:
Offset Begin End Expression
00000060 0000000000400460 0000000000400468 (DW_OP_reg5)
00000060 <End of list>
00000083 0000000000400460 0000000000400463 (DW_OP_breg5: 0; DW_OP_const1u:
32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_const1s: -1; DW_OP_plus)
00000083 0000000000400463 0000000000400468 (DW_OP_breg5: -1)
00000083 0000000000400468 000000000040046c (DW_OP_breg5: -31)
00000083 <End of list>
-----------------------------------------------------------------------------
I believe the loclist at 0x83 should have DW_OP_stack_value on each line.
Even according to recent (offlist) mail by Jakub these are "location
expressions".
I do not see in the DWARF spec. an explicit description what should mean a DIE
reference for DW_AT_upper_bound, currently generated by GCC as:
<82> DW_AT_upper_bound : <0x59>
I believe it was designed to supply there the real variable "l" holding the
value such as if it would be:
<82> DW_AT_upper_bound : <0x4c>
If an artificial variable calculating the same value is used the artificial
variable should simulate it has such _value_ (and not such its _address_).
(This problem is also affecting Fortran dynamic arrays with -O2 -g.)
--
Summary: VLA artificial length var loclist is missing
DW_OP_stack_value
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762