[LLVMbugs] [Bug 2167] New: llvm-gcc generates debug info for compiler-generated temporaries

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Mar 20 02:47:12 PDT 2008


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

           Summary: llvm-gcc generates debug info for compiler-generated
                    temporaries
           Product: tools
           Version: 2.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jay.foad at antixlabs.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1553)
 --> (http://llvm.org/bugs/attachment.cgi?id=1553)
source file

With the attached source:

$ ~/llvm-gcc4.2-2.2-x86-linux-RHEL4/bin/llvm-gcc -g -o main main.c
$ gdb main GNU gdb 6.4.90-debian
[...]
(gdb) b main
Breakpoint 1 at 0x80483b5: file /home/foad//main.c, line 12.
(gdb) run
[...]
Breakpoint 1, main (argc=1, argv=0xbfb86c74) at /home/foad//main.c:12
12        for (i = 0; i < 256 ; i++)
(gdb) info locals
k = 0
j = -1209057292
i = -1210246004
val = "..."
buf = "..."
iftmp.5 = 0
(gdb) 

It seems wrong that "iftmp.5" is listed as a local variable here, because there
is no such variable in my program. Presumably it's some temporary value
generated by the compiler.


My suggested fix is not to emit any debug info for "artificial" variables:

Index: llvm-debug.cpp
===================================================================
--- llvm-debug.cpp      (revision 48589)
+++ llvm-debug.cpp      (working copy)
@@ -315,6 +315,10 @@
 /// region - "llvm.dbg.declare."
 void DebugInfo::EmitDeclare(tree decl, unsigned Tag, const char *Name,
                             tree type, Value *AI, BasicBlock *CurBB) {
+  // Ignore compiler temporaries.
+  if (DECL_ARTIFICIAL(decl))
+    return;
+
   // Lazily construct llvm.dbg.declare function.
   const PointerType *EmpPtr = SR.getEmptyStructPtrType();
   if (!DeclareFn)


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