<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 - [LLVM-COV] No coverage with goto and label"
   href="https://bugs.llvm.org/show_bug.cgi?id=50777">50777</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LLVM-COV] No coverage with goto and label
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Runtime Libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>libprofile library
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>cnwy1996@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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 <stdlib.h>
#include<stdio.h>

short a = 65531;
int b = 3, f;
signed char c, d;
static void fn1(int p1) {
  short e;
  b = f;
  if (f > p1 && p1)
  L:
    for (printf("Executed!\n"); 0;)
      ;
  else if (d)
    b = 0 >= b;
  for (; e <= 3; e++) {
    if (b)
      continue;
    b = 3;
    goto L;
  }
}

int main() {
  for (; c >= 0; c--) {
    fn1(a);
  }
  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
Executed!
Executed!
    1|       |#include <stdlib.h>
    2|       |#include<stdio.h>
    3|       |
    4|       |short a = 65531;
    5|       |int b = 3, f;
    6|       |signed char c, d;
    7|      1|static void fn1(int p1) {
    8|      1|  short e;
    9|      1|  b = f;
   10|      1|  if (f > p1 && p1)
   11|      3|  L:
   12|      3|    for (printf("Executed!\n"); 0;)
   13|      0|      ;
   14|      0|  else if (d)
   15|      0|    b = 0 >= b;
   16|      6|  for (; e <= 3; e++) {
   17|      5|    if (b)
   18|      4|      continue;
   19|      1|    b = 3;
   20|      1|    goto L;
   21|      1|  }
   22|      2|}
   23|       |
   24|      1|int main() {
   25|      2|  for (; c >= 0; c--) {
   26|      1|    fn1(a);
   27|      1|  }
   28|      1|  return 0;
   29|      1|}

Line 11 and 12 should only be executed 2 twice</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>