https://bugs.llvm.org/show_bug.cgi?id=49430

            Bug ID: 49430
           Summary: [LLVM-COV] Split "for" statement has different
                    coverage
           Product: Runtime Libraries
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libprofile library
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

$ 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
#include <stdio.h>

int main() {
  for (int *p = (int[]){1, 2, 3, 0}; /* { dg-error "array" } */
       *p; 
      ++p) {
    printf("%d\n", *p);
  }
  return 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
2
3
    1|       |#include <stdio.h>
    2|       |
    3|      1|int main() {
    4|      1|  for (int *p = (int[]){1, 2, 3, 0}; /* { dg-error "array" } */
    5|      4|       *p; 
    6|      3|      ++p) {
    7|      3|    printf("%d\n", *p);
    8|      3|  }
    9|      1|  return 0;
   10|      1|}


When split, for statement has different coverage in different line. I
understand it clearly, but is it more reasonable to unify their counts from the
perspective of statement coverage?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to