[LLVMbugs] [Bug 21246] New: DWARF template value parameter of 'reference' type incorrectly has 'pointer' type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 10 16:51:25 PDT 2014


            Bug ID: 21246
           Summary: DWARF template value parameter of 'reference' type
                    incorrectly has 'pointer' type
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: warren_ristow at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Compiling the following test-case at '-O0 -g':

    extern "C" int printf(const char *, ...);

    template <int &v>
    int reference()
        return v;

    int a = 42;

    int main()
        int x;
        x = reference<a>();
        printf("x = %d\n", x);
        return 0;

produces an incorrect description of 'v'.  It is described as a pointer to an
int, rather than a reference to an int.  An edited/trimmed version of the
output of llvm-dwarfdump is:

0x0000000b: DW_TAG_compile_unit [1] *
              DW_AT_producer [DW_FORM_strp]
                ( .debug_str[0x00000000] = "clang version 3.6.0 (trunk
0x0000006e:   DW_TAG_subprogram [6] *
                DW_AT_name [DW_FORM_strp]
                  ( .debug_str[0x0000006b] = "reference<&a>")
0x0000008b:     DW_TAG_template_value_parameter [7]  
                  DW_AT_type [DW_FORM_ref4]     (cu + 0x00a0 => {0x000000a0})
                  DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000053] = "v")
0x000000a0:   DW_TAG_pointer_type [8]  
                DW_AT_type [DW_FORM_ref4]       (cu + 0x003f => {0x0000003f})

The problem was found on an x86_64 target, 'clang --version':

  clang version 3.6.0 (trunk 219524)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix

but also tested with '-target ppu', and it had the same behavior.

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/20141010/2de00a38/attachment.html>

More information about the llvm-bugs mailing list