This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/62225] New: DW_AT_location for local variable is missing


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62225

            Bug ID: 62225
           Summary: DW_AT_location for local variable is missing
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qiyao at gcc dot gnu.org

$ cat 1.c 
/* typedef long long TYPE; */
/* typedef double TYPE; */
/* typedef float TYPE; */
typedef long double TYPE;

TYPE
add (register TYPE u, register TYPE v)
{
  return u + v;
}

int
wack (register TYPE u, register TYPE v)
{
  register TYPE l = u, r = v;
  l = add (l, r);
  return (int) (l + r);
}

int
main (void)
{
  wack (-1, -2);
  return 0;
}
---------------------

Compile it with i686-pc-linux-gnu gcc mainline (4.10.0 20140611),
$ gcc 1.c -g -O0 -o mainline.exe

Then, check the debug information,

<1><67>: Abbrev Number: 6 (DW_TAG_subprogram)
    <68>   DW_AT_external    : 1    
    <68>   DW_AT_name        : (indirect string, offset: 0x88): wack    
    <6c>   DW_AT_decl_file   : 1    
    <6d>   DW_AT_decl_line   : 13    
    <6e>   DW_AT_prototyped  : 1    
    <6e>   DW_AT_type        : <0xab>    
    <72>   DW_AT_low_pc      : 0x80483a8    
    <76>   DW_AT_high_pc     : 0x47    
    <7a>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <7c>   DW_AT_GNU_all_tail_call_sites: 1    
    <7c>   DW_AT_sibling     : <0xab>    
 <2><80>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <81>   DW_AT_name        : u    
    <83>   DW_AT_decl_file   : 1    
    <84>   DW_AT_decl_line   : 13    
    <85>   DW_AT_type        : <0x25>    
    <89>   DW_AT_location    : 2 byte block: 91 0     (DW_OP_fbreg: 0)
 <2><8c>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <8d>   DW_AT_name        : v    
    <8f>   DW_AT_decl_file   : 1    
    <90>   DW_AT_decl_line   : 13    
    <91>   DW_AT_type        : <0x25>    
    <95>   DW_AT_location    : 2 byte block: 91 c     (DW_OP_fbreg: 12)
 <2><98>: Abbrev Number: 7 (DW_TAG_variable)
    <99>   DW_AT_name        : l    
    <9b>   DW_AT_decl_file   : 1    
    <9c>   DW_AT_decl_line   : 15    
    <9d>   DW_AT_type        : <0x25>    
 <2><a1>: Abbrev Number: 7 (DW_TAG_variable)
    <a2>   DW_AT_name        : r    
    <a4>   DW_AT_decl_file   : 1    
    <a5>   DW_AT_decl_line   : 15    
    <a6>   DW_AT_type        : <0x25>    
 <2><aa>: Abbrev Number: 0

DW_AT_location is missing for 'l' and 'r'.  This problem also exists on 4.9.2
and 4.8.3, but 4.7.3 is correct.

 <1><6c>: Abbrev Number: 6 (DW_TAG_subprogram)
    <6d>   DW_AT_external    : 1    
    <6e>   DW_AT_name        : (indirect string, offset: 0x5d): wack    
    <72>   DW_AT_decl_file   : 1    
    <73>   DW_AT_decl_line   : 13    
    <74>   DW_AT_prototyped  : 1    
    <75>   DW_AT_type        : <0xbb>    
    <79>   DW_AT_low_pc      : 0x80483f9    
    <7d>   DW_AT_high_pc     : 0x8048443    
    <81>   DW_AT_frame_base  : 0x38    (location list)
    <85>   DW_AT_GNU_all_tail_call_sites: 1    
    <86>   DW_AT_sibling     : <0xbb>    
 <2><8a>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <8b>   DW_AT_name        : u    
    <8d>   DW_AT_decl_file   : 1    
    <8e>   DW_AT_decl_line   : 13    
    <8f>   DW_AT_type        : <0x25>    
    <93>   DW_AT_location    : 2 byte block: 75 8     (DW_OP_breg5 (ebp): 8)
 <2><96>: Abbrev Number: 5 (DW_TAG_formal_parameter)
    <97>   DW_AT_name        : v    
    <99>   DW_AT_decl_file   : 1    
    <9a>   DW_AT_decl_line   : 13    
    <9b>   DW_AT_type        : <0x25>    
    <9f>   DW_AT_location    : 2 byte block: 75 14     (DW_OP_breg5 (ebp): 20)
 <2><a2>: Abbrev Number: 7 (DW_TAG_variable)
    <a3>   DW_AT_name        : l    
    <a5>   DW_AT_decl_file   : 1    
    <a6>   DW_AT_decl_line   : 15    
    <a7>   DW_AT_type        : <0x25>    
    <ab>   DW_AT_location    : 2 byte block: 75 6c     (DW_OP_breg5 (ebp): -20)
 <2><ae>: Abbrev Number: 7 (DW_TAG_variable)
    <af>   DW_AT_name        : r    
    <b1>   DW_AT_decl_file   : 1    
    <b2>   DW_AT_decl_line   : 15    
    <b3>   DW_AT_type        : <0x25>    
    <b7>   DW_AT_location    : 2 byte block: 75 60     (DW_OP_breg5 (ebp): -32)
 <2><ba>: Abbrev Number: 0

This test case is modified a little from GDB test gdb.base/store.c, and this PR
causes some fails in gdb.base/store.exp.  The problem also exists if I typedef
TYPE by long long, double, or float.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]