<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - DWARF template value parameter of 'reference' type incorrectly has 'pointer' type"
   href="http://llvm.org/bugs/show_bug.cgi?id=21246">21246</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DWARF template value parameter of 'reference' type incorrectly has 'pointer' type
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>warren_ristow@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
219524)")
  ...
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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>