<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Wrong line hit counts for a single-line function"
   href="https://bugs.llvm.org/show_bug.cgi?id=38065">38065</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong line hit counts for a single-line function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcastelluccio@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20522" name="attach_20522" title="Archive with GCNO, GCDA, source file and GCOV output">attachment 20522</a> <a href="attachment.cgi?id=20522&action=edit" title="Archive with GCNO, GCDA, source file and GCOV output">[details]</a></span>
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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>