[llvm-bugs] [Bug 39795] New: Coverage report is wrong : the count after executing exit(1) is wrong

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 26 16:57:30 PST 2018


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

            Bug ID: 39795
           Summary: Coverage report is wrong : the count after executing
                    exit(1) is wrong
           Product: compiler-rt
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: ueno.masakazu at jp.fujitsu.com
                CC: llvm-bugs at lists.llvm.org

For the cooverage report, the count after executing exit(1) is wrong.


$ clang --version             
clang version 8.0.0 (trunk 347601)            
Target: x86_64-unknown-linux-gnu              
Thread model: posix                           
InstalledDir: /opt/llvm/svn-trunk/install/bin 


$ clang --coverage cov_ng.c 
$ ./a.out
sub start
sub end
sub start
sub end
sub start
sub end
sub start
$ llvm-cov gcov cov_ng.c
File 'cov_ng.c'
Lines executed:100.00% of 13
cov_ng.c:creating 'cov_ng.c.gcov'
$ cat cov_ng.c.gcov
        -:    0:Source:cov_ng.c
        -:    0:Graph:cov_ng.gcno
        -:    0:Data:cov_ng.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:
        -:    2:
        -:    3:#include <stdio.h>
        -:    4:#include <stdlib.h>
        -:    5:
        4:    6:void sub (int x) {
        -:    7:
        4:    8:  printf("sub start\n");
        -:    9:
        4:   10:  if (x == 0) {
        1:   11:    exit (1);
        -:   12:    printf("NG");
        -:   13:  }
        -:   14:
        3:   15:  printf("sub end\n");
        3:   16:  return ;
        -:   17:}
        -:   18:
        1:   19:int main () {
        1:   20:  sub (10);
        1:   21:  sub (10);
        1:   22:  sub (10);
        1:   23:  sub (0);
        1:   24:  sub (10);
        1:   25:}
        -:   26:

  For the counts on lines 24 and 25, "-:" is correct, not "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/20181127/3cdc676f/attachment-0001.html>


More information about the llvm-bugs mailing list