| Issue |
160248
|
| Summary |
llvm-cov wrongly reported execution count as 0 for executed functions
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
zsrkmyn
|
Reproducer:
```
$ cat foo.h
inline int foo(int a, int b, int c, int d, int e, int f) {
if (a != b)
return a < b;
if (c != d)
return c < d;
if (a != c)
return a < c;
return e < f;
}
$ cat bar.c
#include "foo.h" // This is used to generate an unused record with hash 0 for foo()
int unused;
$ cat main.c
#include "foo.h"
int main() {
return foo(4, 4, 8, 6, 2, 3);
}
$ clang -O2 -fprofile-instr-generate -fcoverage-mapping -shared bar.c -o libbar.so
$ clang -O2 -fprofile-instr-generate -fcoverage-mapping main.c ./libbar.so -o main
$ ./main
$ llvm-profdata merge ./default.profraw -o default.data
$ llvm-cov show -instr-profile ./default.data -object ./libbar.so -object ./main
foo.h:
1| 0|inline int foo(int a, int b, int c, int d, int e, int f) {
2| 0| if (a != b)
3| 0| return a < b;
4| 0| if (c != d)
5| 0| return c < d;
6| 0| if (a != c)
7| 0| return a < c;
8| 0| return e < f;
9| 0|}
main.c:
1| |#include "foo.h"
2| |
3| 1|int main() {
4| 1| return foo(4, 4, 8, 6, 2, 3);
5| 1|}
```
clang version:
```
$ clang --version
Homebrew clang version 21.1.1
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: .../homebrew/Cellar/llvm/21.1.1/bin
Configuration file: .../homebrew/etc/clang/arm64-apple-darwin24.cfg
```
In main.c, `foo()` was called once, but in foo.h, it's reported as unexecuted.
The root cause is stupid, I'll post in the later comment.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs