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

            Bug ID: 85336
           Summary: [GCOV] wrong coverage for builtin functions and "||"
                    logic operators in return statement
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yangyibiao at nju dot edu.cn
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$ cat small.c
#include <string.h>

static int special_format (const char *fmt)
{
  return (
    strchr (fmt, '*') != 0 ||
    strchr (fmt, 'V') != 0 ||
    strchr (fmt, 'S') != 0 ||
    strchr (fmt, 'n') != 0 );
}

int main()
{
  special_format ("ee");
  return 0;
}

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

        -:    0:Source:small.c
        -:    0:Graph:small.gcno
        -:    0:Data:small.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:#include <string.h>
        -:    2:
        1:    3:static int special_format (const char *fmt)
        -:    4:{
        -:    5:  return (
        2:    6:    strchr (fmt, '*') != 0 ||
        1:    7:    strchr (fmt, 'V') != 0 ||
        3:    8:    strchr (fmt, 'S') != 0 ||
        1:    9:    strchr (fmt, 'n') != 0 );
        -:   10:}
        -:   11:
        1:   12:int main()
        -:   13:{
        1:   14:  special_format ("ee");
        1:   15:  return 0;
        -:   16:}


Line #6, #7, #8, #9 are wrongly marked with different different execution times
in a single return statement.

Reply via email to