https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101644

            Bug ID: 101644
           Summary: [GCOV] Label after "return" has wrong coverage.
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: njuwy at smail dot nju.edu.cn
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++
-disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC) 

$ cat test.c
#include<stdlib.h>
#include<stdio.h>
int main() {
l1:
  return &&l1 - &&l2;
l2:
  printf("Executed\n");
}

$ gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov
File 'test.c'
Lines executed:100.00% of 4
Creating 'test.c.gcov'

        -:    0:Source:test.c
        -:    0:Graph:test.gcno
        -:    0:Data:test.gcda
        -:    0:Runs:1
        -:    1:#include<stdlib.h>
        -:    2:#include<stdio.h>
        1:    3:int main() {
        1:    4:l1:
        1:    5:  return &&l1 - &&l2;
        1:    6:l2:
        -:    7:  printf("Executed\n");
        -:    8:}

Line 6 was wrongly marked as executed.

Reply via email to