<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 --- - char[4] variable has no DWARF location at -O2"
href="https://llvm.org/bugs/show_bug.cgi?id=30641">30641</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>char[4] variable has no DWARF location at -O2
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>paul_robinson@playstation.sony.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>A 4-byte or 8-byte array of char is given no DWARF location attribute
at -O2, even though it actually does have a stack location.
////////////////////////////////
extern void DoNothing(const unsigned char *pData);
int main()
{
unsigned char correctly_tracked[5] = { 1, 2, 3, 4, 5 };
unsigned char no_location[4] = { 1, 2, 3, 4 }; // or [8]
DoNothing(correctly_tracked);
DoNothing(no_location);
return 0;
}
////////////////////////////////
<2><43>: Abbrev Number: 3 (DW_TAG_variable)
<44> DW_AT_location : 2 byte block: 91 4 (DW_OP_fbreg: 4)
<47> DW_AT_name : (indirect string, offset: 0x5a):
correctly_tracked
<4b> DW_AT_decl_file : 1
<4c> DW_AT_decl_line : 5
<4d> DW_AT_type : <0x6f>
<2><51>: Abbrev Number: 4 (DW_TAG_variable)
<52> DW_AT_name : (indirect string, offset: 0x83): no_location
<56> DW_AT_decl_file : 1
<57> DW_AT_decl_line : 6
<58> DW_AT_type : <0x89>
In IR dumped with -disable-llvm-optzns, no_location has [4 x i8] type
and the relevant dbg.declare and so forth.
Without -disable-llvm-optzns, no_location has become i32 and lost all
that stuff. So even though it still has a stack location, the DWARF
does not report it.
(Type info is correct so I omitted it above.)</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>