[llvm-bugs] [Bug 38065] New: Wrong line hit counts for a single-line function
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 5 03:47:38 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38065
Bug ID: 38065
Summary: Wrong line hit counts for a single-line function
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: mcastelluccio at mozilla.com
CC: llvm-bugs at lists.llvm.org
Created attachment 20522
--> https://bugs.llvm.org/attachment.cgi?id=20522&action=edit
Archive with GCNO, GCDA, source file and GCOV output
clang --coverage -fno-exceptions -O0 main.c
./a.out
llvm-cov gcov main.gcda
The result is:
-: 0:Source:main.c
-: 0:Graph:main.gcno
-: 0:Data:main.gcda
-: 0:Runs:1
-: 0:Programs:1
3: 1:void f(int K) { if (K) {} }
-: 2:
-: 3:int main(void)
-: 4:{
1: 5: f(5);
-: 6:
1: 7: return 0;
-: 8:}
Or with llvm-cov gcov -a -b -c main.gcda:
-: 0:Source:main.c
-: 0:Graph:main.gcno
-: 0:Data:main.gcda
-: 0:Runs:1
-: 0:Programs:1
function f called 1 returned 100% blocks executed 100%
1: 1:void f(int K) { if (K) {} }
1: 1-block 0
branch 0 taken 1
branch 1 taken 0
1: 1-block 1
1: 1-block 2
-: 2:
function main called 1 returned 100% blocks executed 100%
-: 3:int main(void)
-: 4:{
1: 5: f(5);
-: 6:
1: 7: return 0;
1: 7-block 0
-: 8:}
Clearly, f is only called once, so the count should be 1 and not 3.
--
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/20180705/0e0a721a/attachment.html>
More information about the llvm-bugs
mailing list