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

            Bug ID: 38066
           Summary: Wrong line hit counts when building without
                    "-fno-exceptions"
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: profile
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Created attachment 20523
  --> https://bugs.llvm.org/attachment.cgi?id=20523&action=edit
Archive with GCNO, GCDA, source file and GCOV output

clang++ --coverage -O0 main.cpp
./a.out
llvm-cov gcov main.gcda

The result is:
        -:    0:Source:main.cpp
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:#include <iostream>
        -:    2:#include <string>
        -:    3:
        -:    4:using namespace std;
        -:    5:
        2:    6:class Ciao {
        -:    7:  public:
        -:    8:    void setName(string n) {
        1:    9:      name = n;
        1:   10:    }
        -:   11:
        -:   12:  private:
        -:   13:    string name;
        -:   14:};
        -:   15:
        -:   16:int main(void)
        -:   17:{
        1:   18:  Ciao ciao;
        -:   19:
        3:   20:  ciao.setName("marco");
        -:   21:
        1:   22:  return 0;
        1:   23:}

Or with llvm-cov gcov -a -b -c main.gcda:
        -:    0:Source:main.cpp
        -:    0:Graph:main.gcno
        -:    0:Data:main.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:#include <iostream>
        -:    2:#include <string>
        -:    3:
        -:    4:using namespace std;
        -:    5:
function _ZN4CiaoC2Ev called 1 returned 100% blocks executed 100%
function _ZN4CiaoD2Ev called 1 returned 100% blocks executed 100%
        1:    6:class Ciao {
        1:    6-block  0
        1:    6-block  1
        -:    7:  public:
function _ZN4Ciao7setNameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
called 1 returned 100% blocks executed 100%
        -:    8:    void setName(string n) {
        1:    9:      name = n;
        1:   10:    }
        1:   10-block  0
        -:   11:
        -:   12:  private:
        -:   13:    string name;
        -:   14:};
        -:   15:
function main called 1 returned 100% blocks executed 50%
        -:   16:int main(void)
        -:   17:{
        1:   18:  Ciao ciao;
        -:   19:
        1:   20:  ciao.setName("marco");
        1:   20-block  0
branch  0 taken 1
branch  1 taken 0
        1:   20-block  1
branch  2 taken 1
branch  3 taken 0
    $$$$$:   20-block  2
        -:   21:
        1:   22:  return 0;
        1:   23:}
        1:   23-block  0
    $$$$$:   23-block  1
    $$$$$:   23-block  2
    $$$$$:   23-block  3

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

Reply via email to