<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 - vla var with typedef'd type has incomplete debug info"
href="https://bugs.llvm.org/show_bug.cgi?id=48247">48247</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>vla var with typedef'd type has incomplete debug info
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vries@gcc.gnu.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Consider test.c:
...
int n = 5;
int a = 1;
int
main (void)
{
#if V == 1
int vla[n];
#elif V == 2
typedef int vla_t[n];
vla_t vla;
#endif
for (int i = 0; i < n; i++)
vla[i] = i;
return vla[a];
}
...
With gcc, we print the correct type of vla in both V=1 and V=2 cases:
...
$ gcc test.c -g -DV=1
$ gdb -batch a.out -ex "b 17" -ex run -ex "ptype vla"
Breakpoint 1 at 0x400533: file test.c, line 17.
Breakpoint 1, main () at test.c:17
17 return vla[a];
type = int [5]
$ gcc test.c -g -DV=2
$ gdb -batch a.out -ex "b 17" -ex run -ex "ptype vla"
Breakpoint 1 at 0x400533: file test.c, line 17.
Breakpoint 1, main () at test.c:17
17 return vla[a];
type = int [5]
...
With clang-10, that's only for V=1:
...
$ clang test.c -g -DV=1
$ gdb -batch a.out -ex "b 17" -ex run -ex "ptype vla"
Breakpoint 1 at 0x40050e: file test.c, line 17.
Breakpoint 1, main () at test.c:17
17 return vla[a];
type = int [5]
$ clang test.c -g -DV=2
$ gdb -batch a.out -ex "b 17" -ex run -ex "ptype vla"
Breakpoint 1 at 0x40050e: file test.c, line 17.
Breakpoint 1, main () at test.c:17
17 return vla[a];
type = int []
...
With clang and V=2, the variable vla:
...
<2><147>: Abbrev Number: 6 (DW_TAG_variable)
<14c> DW_AT_name : (indirect string, offset: 0x21d): vla
<152> DW_AT_type : <0x172>
...
has type:
...
<2><172>: Abbrev Number: 9 (DW_TAG_typedef)
<173> DW_AT_type : <0x185>
<177> DW_AT_name : (indirect string, offset: 0x235): vla_t
...
which refers to type:
...
<1><185>: Abbrev Number: 10 (DW_TAG_array_type)
<186> DW_AT_type : <0x106>
<2><18a>: Abbrev Number: 11 (DW_TAG_subrange_type)
<18b> DW_AT_type : <0x190>
...
There's no DW_AT_count for the DW_TAG_subrange_type.</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>