[llvm-bugs] [Bug 51023] New: [llvm-cov]
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 8 05:09:35 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51023
Bug ID: 51023
Summary: [llvm-cov]
Product: Runtime Libraries
Version: 12.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: libprofile library
Assignee: unassignedbugs at nondot.org
Reporter: byone.heng at gmail.com
CC: llvm-bugs at lists.llvm.org
$./clang -v
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
b6c8feb29fce39121884f7e08ec6eb0f58da3fb7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/x/project/llvm-project/build/install/bin/.
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$cat test.c
———————————————————
const volatile unsigned char true_var = 1;
static unsigned short int false_var = 0;
int a = 2, b, c, d;
int
foo ()
{
for (;; c++)
if ((b > 0) | (a & 1))
;
else
{
d = a;
return 0;
}
}
int
main ()
{
foo ();
if (d != 2)
__builtin_abort ();
return 0;
——————————————————
$clang -O0 -g -fcoverage-mapping -fprofile-instr-generate=test.profraw test.c;
./a.out; llvm-profdata merge test.profraw -o test.profdata; llvm-cov show a.out
-instr-profile=test.profdata test.c > test.lcov; cat test.lcov
3| |const volatile unsigned char true_var = 1;
4| |static unsigned short int false_var = 0;
5| |
6| |int a = 2, b, c, d;
7| |
8| |int
9| |foo ()
10| 1|{
11| 0| for (;; c++)
12| 1| if ((b > 0) | (a & 1))
13| 0| ;
14| 1| else
15| 1| {
16| 1| d = a;
17| 1| return 0;
18| 1| }
19| 1|}
20| |
21| |int
22| |main ()
23| 1|{
24| 1| foo ();
25| 1| if (d != 2)
26| 0| __builtin_abort ();
27| 1| return 0;
28| 1|}
Line 11 should be executed once.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210708/75acde70/attachment.html>
More information about the llvm-bugs
mailing list