[llvm-bugs] [Bug 49435] New: [LLVM-COV] Wrong coverage with split logical expression
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 4 04:31:01 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49435
Bug ID: 49435
Summary: [LLVM-COV] Wrong coverage with split logical
expression
Product: Runtime Libraries
Version: 11.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: libprofile library
Assignee: unassignedbugs at nondot.org
Reporter: cnwy1996 at outlook.com
CC: llvm-bugs at lists.llvm.org
$ clang -v
clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wangyang/llvm-project/build/bin
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
Selected multilib: .;@m64
$ cat test.c
int f(int x){
return -x;
}
int f1(int x,int y){
return x+3-y;
}
int f2(int x,int y){
return x+y;
}
int f3(int x){
return 2*x;
}
int main(){
int a=1,b=0,y;
y = f(b && f1(f3(a),
f2(f3(a),a+2)));
y=(b &&
0);
}
$ clang -w -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
1| 1|int f(int x){
2| 1|return -x;
3| 1|}
4| 0|int f1(int x,int y){
5| 0|return x+3-y;
6| 0|}
7| 0|int f2(int x,int y){
8| 0|return x+y;
9| 0|}
10| 0|int f3(int x){
11| 0|return 2*x;
12| 0|}
13| |
14| 1|int main(){
15| 1|int a=1,b=0,y;
16| 1| y = f(b && f1(f3(a),
17| 0| f2(f3(a),a+2)));
18| 1| y=(b &&
19| 1| 0);
20| 1|
21| 1|}
Its a bit similar to bug 49430, however I think the coverage of line #17 and
line #19 should be consistent,no matter 0 or 1.
--
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/20210304/f7619bae/attachment.html>
More information about the llvm-bugs
mailing list