[Bug gcov-profile/100751] __gcov_dump and __gcov_reset usage

gejoed at rediffmail dot com gcc-bugzilla@gcc.gnu.org
Tue May 25 12:14:59 GMT 2021


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

--- Comment #5 from Gejoe <gejoed at rediffmail dot com> ---
Running the program:
./a.out 
g
When g is passed, return value is 8
When 
 is passed, return value is 0
r
When r is passed, return value is 8
When 
 is passed, return value is 0
<< the program is still running, waiting for next character entry>>



Now if we see the sample-prog.c.gcov file , it shows :
        -:   16:    do {
        -:   17:   
        4:   18:        c = getchar();
        4:   19:        result = isalnum(c);
        4:   20:        printf("When %c is passed, return value is %d\n", c,
result);
        -:   21: 
        4:   22:        if(c == 'g')
        2:   23:            __gcov_dump();
        2:   24:        else if(c == 'r')
    #####:   25:            __gcov_reset();
        -:   26:    
        3:   27:    }while(c != 'c');

Looking at line 25, it doesn't show the line is hit (by giving 'r' character
during a.out run) nor are the counter values reset for the other lines. The
count of 4,3,2 are seen for some lines because of a previous a.out run.


More information about the Gcc-bugs mailing list