<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] A "break;" statement is wrongly marked as executed when it is after the "abort();" statement in switch-case"
href="https://bugs.llvm.org/show_bug.cgi?id=41821">41821</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[LLVM-COV] A "break;" statement is wrongly marked as executed when it is after the "abort();" statement in switch-case
</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>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@nju.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.0-svn358899-1~exp1+0~20190422164136.937~1.gbpac4d8e (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ rm a.out small.lcov small.p*; clang -w -O0 -g -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.lcov; cat small.lcov
1| |int main()
2| 1|{
3| 1| switch (8)
4| 1| {
5| 1| case 8:
6| 1| break;
7| 1| default:
8| 0| abort ();
9| 1| break;
10| 1| }
11| 1| return 0;
12| 1|}
Line #9 is wrongly marked as executed. In fact, it is obvious that Line #9 is
not executed.
When Line #8 is removed, the coverage is correct as follows:
$ rm a.out small.lcov small.p*; clang -w -O0 -g -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.lcov; cat small.lcov
1| |int main()
2| 1|{
3| 1| switch (8)
4| 1| {
5| 1| case 8:
6| 1| break;
7| 1| default:
8| 0| // abort ();
9| 0| break;
10| 1| }
11| 1| return 0;
12| 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>