[LLVMbugs] [Bug 19298] New: Const integer variables are duplicated in the root scope

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 31 20:11:18 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19298

            Bug ID: 19298
           Summary: Const integer variables are duplicated in the root
                    scope
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: katya_romanova at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

A 'const int' variable declared in a function gets two separate entries in the
DWARF debug info generated by LLVM; there should be only one entry. The
extraneous copy is created in the root scope of the debug information. This
problem only affects integer-type constants.

The simple example attached shows a const variable 'd' declared in the main
function. Examining the DWARF debug info shows that it appears twice in the
debug info; once inside the main function, and once at the root level. The
example is compiled without optimizations (-O0).

========================
int main()
{
        const int d = 4;
        const float e = 4;
        const char* f = "Woopy";
        return d;
}
========================

 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_producer    : (indirect string, offset: 0x0): clang version
3.5.0 (trunk 203177)
    <10>   DW_AT_language    : 4        (C++)
    <12>   DW_AT_name        : (indirect string, offset: 0x23): main.cpp
    <16>   DW_AT_stmt_list   : 0x0
    <1a>   DW_AT_comp_dir    : (indirect string, offset: 0x2c):
/home/kromanova/
    <1e>   DW_AT_low_pc      : 0x0
 <1><26>: Abbrev Number: 2 (DW_TAG_variable)
    <27>   DW_AT_name        : (indirect string, offset: 0x62): d
    <2b>   DW_AT_type        : <0x32>
    <2f>   DW_AT_decl_file   : 1
    <30>   DW_AT_decl_line   : 3
    <31>   DW_AT_const_value : 4

.............

 <1><3e>: Abbrev Number: 5 (DW_TAG_subprogram)
    <3f>   DW_AT_name        : (indirect string, offset: 0x68): main
    <43>   DW_AT_decl_file   : 1
    <44>   DW_AT_decl_line   : 1
    <45>   DW_AT_type        : <0x37>
    <49>   DW_AT_external    : 1
    <49>   DW_AT_accessibility: 1       (public)
    <4a>   DW_AT_low_pc      : 0x0
    <52>   DW_AT_high_pc     : 0x39
    <5a>   DW_AT_frame_base  : 1 byte block: 56         (DW_OP_reg6 (rbp))
 <2><5c>: Abbrev Number: 6 (DW_TAG_variable)
    <5d>   DW_AT_name        : (indirect string, offset: 0x62): d
    <61>   DW_AT_decl_file   : 1
    <62>   DW_AT_decl_line   : 3
    <63>   DW_AT_type        : <0x32>
    <67>   DW_AT_location    : 2 byte block: 91 78      (DW_OP_fbreg: -8)

-- 
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/20140401/7d5fbbc3/attachment.html>


More information about the llvm-bugs mailing list