[llvm-bugs] [Bug 30641] New: char[4] variable has no DWARF location at -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 7 11:25:07 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30641

            Bug ID: 30641
           Summary: char[4] variable has no DWARF location at -O2
           Product: libraries
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: paul_robinson at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.)

-- 
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/20161007/ad53d7de/attachment-0001.html>


More information about the llvm-bugs mailing list