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

            Bug ID: 121077
           Summary: [GCOV] Another abnormal cov pattern about ternary
                    operators
           Product: gcc
           Version: 16.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
  Target Milestone: ---

gcc version:
gcc version 16.0.0 20250704 (experimental) (GCC) 

option:
--coverage -std=c2x

$ cat test.c
#include <stdio.h>
int main() {
    int x = 10,y=5;
    int z = x > y  
            ?(x + y)*2  
            :y - x;
    printf("z = %d\n", z);
    return 0;
}

output:
z = 30

$ cat test.c.gcov
        -:    1:#include <stdio.h>
        1:    2:int main() {
        1:    3:    int x = 10,y=5;
    #####:    4:    int z = x > y  
        1:    5:            ?(x + y)*2  
        1:    6:            :y - x;
        1:    7:    printf("z = %d\n", z);
        1:    8:    return 0;
        -:    9:}


without comma expression, the line 4 was marked as not executed.

Reply via email to