[llvm-bugs] [Bug 35437] New: [LLVM-COV] Two continuous "for" statements lead to incorrect coverage information
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 27 07:58:06 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35437
Bug ID: 35437
Summary: [LLVM-COV] Two continuous "for" statements lead to
incorrect coverage information
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: yangyibiao at nju.edu.cn
CC: llvm-bugs at lists.llvm.org
$ clang -v
clang version 6.0.0-svn318792-1~exp1 (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/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
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.3.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.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.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.2.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
$ cat small.c
int main()
{
int i=0, k=0;
for (; i<1; i++) {
return 0;
}
for (; k<1; k++){
return 1;
}
}
$ 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.gcov
$ cat small.gcov
1| |int main()
2| 1|{
3| 1| int i=0, k=0;
4| 1| for (; i<1; i++) {
5| 1| return 0;
6| 1| }
7| 1| for (; k<1; k++){
8| 0| return 1;
9| 0| }
10| 1|}
Line #7 is wrongly marked as executed in llvm-cov.
--
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/20171127/c05ca914/attachment.html>
More information about the llvm-bugs
mailing list