<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Incorrect debug info generated for variable size arrays"
href="https://llvm.org/bugs/show_bug.cgi?id=25934">25934</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect debug info generated for variable size arrays
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tberghammer@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>