[LLVMbugs] [Bug 14108] New: duplicated debug info for enums

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 17 05:24:50 PDT 2012


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

             Bug #: 14108
           Summary: duplicated debug info for enums
           Product: clang
           Version: 3.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: olga.a.chupina at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9371
  --> http://llvm.org/bugs/attachment.cgi?id=9371
clang output with debug info

Consider the following test:
$ cat test.c 
int main (int argc) {
    enum NUMBERS {ONE = 1, TWO = 2, THREE = 3} num;
    num = ONE;
    if (argc == num) {
        return 0;
    } else {
        return 1;
    } 
}

The compile unit debug info descriptor contains two identical metadata nodes in
the list of enums:

!llvm.dbg.cu = !{!0}

!0 = metadata !{i32 786449, i32 0, i32 12, metadata !"test.c", metadata
!"testdir", metadata !"clang version 3.1 (trunk)", i1 true, i1 false, metadata
!"", i32 0, metadata !1, metadata !15, metadata !17, metadata !15} ; [
DW_TAG_compile_unit ]
!1 = metadata !{metadata !2}
!2 = metadata !{metadata !3, metadata !3}
!3 = metadata !{i32 786436, metadata !4, metadata !"NUMBERS", metadata !5, i32
2, i64 32, i64 32, i32 0, i32 0, null, metadata !11, i32 0, i32 0} ; [
DW_TAG_enumeration_type ]
!11 = metadata !{metadata !12, metadata !13, metadata !14}
!12 = metadata !{i32 786472, metadata !"ONE", i64 1} ; [ DW_TAG_enumerator ]
!13 = metadata !{i32 786472, metadata !"TWO", i64 2} ; [ DW_TAG_enumerator ]
!14 = metadata !{i32 786472, metadata !"THREE", i64 3} ; [ DW_TAG_enumerator ]

It looks like the enumeration metadata node appears in the CU descriptor as
many times as enumerators are addressed in the source code. Once I add another
variable:

      enum NUMBERS count = TWO;

one more !3 metadata is added to the list of enums: 

      !2 = metadata !{metadata !3, metadata !3, metadata !3}



Compilation line: clang -S -O0 -g test.c -emit-llvm -o test.bc

The bug is reproducible on MacOS X and Linux.

Olga Chupina
---
Software Engineer
Intel Compiler Team
Intel Corp.

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