[LLVMbugs] [Bug 13362] New: Debug generation broken when Optimization is enabled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 14 11:07:34 PDT 2012


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

             Bug #: 13362
           Summary: Debug generation broken when Optimization is enabled
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: al at allenlee.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8899
  --> http://llvm.org/bugs/attachment.cgi?id=8899
I took the original source and removed code until the bug no longer appeared. 
This source is close to the minimal subset of the original program that still
exhibits the bug.

The debug information generated for this test program is broken when
optimization is enabled at the same time (tested -O1, -O2, & -O3), but works if
it is not.

Found this bug on LLVM/Clang Release 3.1, but reproduced it in the SVN trunk.  
Clang 2.7 works correctly and does not reproduce the bug. 

$ clang -v
clang version 3.2 (trunk 160213)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang -g -O test.c && readelf -w a.out > /dev/null
readelf: Error: Location lists in .debug_info section aren't in ascending
order!
readelf: Warning: Location lists in .debug_loc
readelf: Warning: There is an overlap [0x1c8 - 0xba] in .debug_loc section.
readelf: Warning: There is an overlap [0x126 - 0x0] in .debug_loc section.
readelf: Warning: There are 270 unused bytes at the end of section .debug_loc

$ gdb a.out
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/allen/Dropbox/Courses/MastersProj/llvm-bug/a.out...done.
(gdb) break main
Die: DW_TAG_restrict_type (abbrev 26, offset 0x418)
  parent at offset: 0xb
  has children: FALSE
  attributes:
    DW_AT_type (DW_FORM_ref4) constant ref: 0x413 (adjusted)
Dwarf Error: Cannot find type of die [in module
/home/allen/Dropbox/Courses/MastersProj/llvm-bug/a.out]


$ clang -g test.c && readelf -w a.out > /dev/null
<.. no errors ..>
$ gdb a.out
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/allen/Dropbox/Courses/MastersProj/llvm-bug/a.out...done.
(gdb) break main
Breakpoint 1 at 0x400abc: file test.c, line 92.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list