<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - dwarfdump mis-prints 'const' in a const pointer context"
href="https://bugs.llvm.org/show_bug.cgi?id=36541">36541</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>dwarfdump mis-prints 'const' in a const pointer context
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>llvm-dwarfdump
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>paul_robinson@playstation.sony.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Mentioned in passing in <a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang's debug info does not mark 'this' parameters 'const' but GCC and MSVC do"
href="show_bug.cgi?id=36526">bug 36526</a> but deserving its own report:
llvm-dwarfdump prints the 'const' before the unqualified type name,
which is syntactically incorrect if the unqualified type name is a
pointer. I didn't check but likely any other qualifier would have
the same problem (certainly 'volatile' and probably _Atomic or
however that one is spelled).
$ cat t.cpp
int i = 1;
const int j = 2;
int * const const_ptr_to_int = &i;
const int * ptr_to_const_int = &j;
int foo() {
return *const_ptr_to_int + *ptr_to_const_int;
}
$ clang -c -g t.cpp
$ llvm-dwarfdump -debug-info t.o
...
0x00000046: DW_TAG_variable
DW_AT_name ("ptr_to_const_int")
DW_AT_type (cu + 0x005b "const int*")
...
0x00000065: DW_TAG_variable
DW_AT_name ("const_ptr_to_int")
DW_AT_type (cu + 0x0070 "const int*")
...
Entertainingly, "const int * const foo" comes out as "const const int*".
I could see wrapping the qualified type in parens, or just printing the
qualifier after the referenced type. This means non-pointer types
would have the 'const' appearing on the right, which is a style favored
by some ('int const' rather than 'const int').</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>