<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 - llvm-cov: wrong coverage for setjmp followed by a while loop statement"
href="https://bugs.llvm.org/show_bug.cgi?id=48830">48830</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-cov: wrong coverage for setjmp followed by a while loop statement
</td>
</tr>
<tr>
<th>Product</th>
<td>Runtime 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>enhancement
</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@nju.edu.cn
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>...
Consider this case:
$ cat small.c
void *buf[20];
void foo()
{
__builtin_longjmp (buf, 1);
}
int main ()
{
if(__builtin_setjmp(buf))
return 1;
printf("Hello, world!\n");
while(1)
foo();
}
...
$ clang -O0 -w -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
Hello, world!
1| |void *buf[20];
2| |
3| |void foo()
4| 1|{
5| 1| __builtin_longjmp (buf, 1);
6| 1|}
7| |
8| |int main ()
9| 1|{
10| 1| if(__builtin_setjmp(buf))
11| 1| return 1;
12| |
13| 0| printf("Hello, world!\n");
14| 1| while(1)
15| 1| foo();
16| 0|}
...
We can found that Line #13 is wrongly marked as not executed. However, "Hello,
world!"is printed. This indicates that Line #13 is executed.
$ clang --version
Ubuntu clang version
12.0.0-++20210120052627+c09be0d2a0f9-1~exp1~20210120163331.290
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin</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>