<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 - wrong coverage for the function alloca() call statement"
href="https://bugs.llvm.org/show_bug.cgi?id=45595">45595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>wrong coverage for the function alloca() call statement
</td>
</tr>
<tr>
<th>Product</th>
<td>Runtime Libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>9.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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>libprofile library
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yangyibiao@hust.edu.cn
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ clang -v
clang version 9.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.0
Found candidate GCC installation:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/9.3.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ cat small.c
#include <setjmp.h>
#include <stdlib.h>
jmp_buf buf;
void sub (void)
{
longjmp (buf, 1);
}
int main ()
{
if (setjmp (buf)) {
exit (0);
}
int *q = (int *) alloca (10 * sizeof (int));
for (int i = 0; i < 10; i++)
q[i] = 0;
while (1)
sub ();
}
$ clang -O0 -fcoverage-mapping -fprofile-instr-generate=small.profraw small.c;
./a.out; llvm-profdata merge small.profraw -o small.profdata; llvm-cov show
a.out -instr-profile=small.profdata small.c > small.c.lcov; cat small.c.lcov
1| |#include <setjmp.h>
2| |#include <stdlib.h>
3| |
4| |jmp_buf buf;
5| |
6| |void sub (void)
7| 1|{
8| 1| longjmp (buf, 1);
9| 1|}
10| |
11| |int main ()
12| 1|{
13| 1| if (setjmp (buf)) {
14| 1| exit (0);
15| 1| }
16| 0|
17| 0| int *q = (int *) alloca (10 * sizeof (int));
18| 0|
19| 10| for (int i = 0; i < 10; i++)
20| 10| q[i] = 0;
21| 0|
22| 1| while (1)
23| 1| sub ();
24| 0|}
*****
Line #17 is wrongly marked as not executed. The correct coverage should be
"1|".</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>