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/39474] New: DW_AT_location missing for unused variables even at -O0


It is a regression since gcc-4.3 but it was found only at artificial (GDB)
testcase.  Also at -O2 such behavior is even expected.

The variable is considered as optimized-out which should not happen on -O0.

Testcase:
------------------------------------------------------------------------------
int
main (void)
{
  int var;

  return 0;
}
------------------------------------------------------------------------------

gcc -Wall -g

WRONG gcc-4.4:
    < c>   DW_AT_producer    : (indirect string, offset: 0xb): GNU C 4.4.0
20090315 (experimental)
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2f>   DW_AT_name        : (indirect string, offset: 0x39): main
 <2><52>: Abbrev Number: 3 (DW_TAG_variable)
    <53>   DW_AT_name        : var
    <59>   DW_AT_type        : <0x5e>

Correct gcc-4.3:
    < c>   DW_AT_producer    : (indirect string, offset: 0xf): GNU C 4.3.2
20081105 (Red Hat 4.3.2-7)
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2f>   DW_AT_name        : (indirect string, offset: 0x36): main
 <2><52>: Abbrev Number: 3 (DW_TAG_variable)
    <53>   DW_AT_name        : var
    <59>   DW_AT_type        : <0x61>
    <5d>   DW_AT_location    : 2 byte block: 91 6c      (DW_OP_fbreg: -20)


-- 
           Summary: DW_AT_location missing for unused variables even at -O0
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39474


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