[llvm-bugs] [Bug 25934] New: Incorrect debug info generated for variable size arrays
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 23 05:49:25 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25934
Bug ID: 25934
Summary: Incorrect debug info generated for variable size
arrays
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: tberghammer at google.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Reproducing the issue:
* Compile the followoing code snippet with "clang++ -g var.cpp":
int main() {
for (int i = 0; i < 10; ++i) {
int x[i + 1];
x[0]++;
}
}
* Inspect the debug info for variable 'x'
The relevant parts of the debug info:
<4><6b>: Abbrev Number: 5 (DW_TAG_variable)
<6c> DW_AT_location : 0x0 (location list)
<70> DW_AT_name : (indirect string, offset: 0x71): x
<74> DW_AT_decl_file : 1
<75> DW_AT_decl_line : 3
<76> DW_AT_type : <0x84>
<1><84>: Abbrev Number: 7 (DW_TAG_array_type)
<85> DW_AT_type : <0x7d>
<2><89>: Abbrev Number: 8 (DW_TAG_subrange_type)
<8a> DW_AT_type : <0x8f>
<2><8e>: Abbrev Number: 0
<1><8f>: Abbrev Number: 9 (DW_TAG_base_type)
<90> DW_AT_name : (indirect string, offset: 0x73): sizetype
<94> DW_AT_byte_size : 8
<95> DW_AT_encoding : 7 (unsigned)
<1><96>: Abbrev Number: 0
The problem is that clang specifies a DW_TAG_subrange_type under
DW_TAG_array_type but is fails to fill it in with some information specifying
the number of elements in the array (DW_AT_count or DW_AT_upper_bound).
The issue is reproduced with clang 3.5.0 and with 3.8.0 (trunk 256170). Gcc
4.8.4 generates correct debug info with producing a DW_AT_upper_bound
containing a dwarf expression to a memory location containing the current array
size.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151223/ba8f7b58/attachment.html>
More information about the llvm-bugs
mailing list