https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97925
Bug ID: 97925 Summary: [GCOV]incorrect code coverage for function call for when multiple Logical OR expressions of a "if" statement in different lines Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: yangyibiao at outlook dot com CC: marxin at gcc dot gnu.org Target Milestone: --- $ cat test.c long f1(long a) {return a&0xff000000L;} long f2(long a) {return a&~0xff000000L;} long f3(long a) {return a&~0x0000ffffL;} int main () { long a = 0x89ABCDEF; if (f1(a)!=0x89000000L|| f2(a)!=0x00ABCDEFL|| f3(a)!=0x89AB0000L) return 1; return 0; } $ gcc -O0 --coverage test.c; ./a.out; gcov test.c; cat test.c.gcov File 'test.c' Lines executed:90.00% of 10 Creating 'test.c.gcov' -: 0:Source:test.c -: 0:Graph:test.gcno -: 0:Data:test.gcda -: 0:Runs:1 1: 1:long f1(long a) {return a&0xff000000L;} 1: 2:long f2(long a) {return a&~0xff000000L;} 1: 3:long f3(long a) {return a&~0x0000ffffL;} -: 4: 1: 5:int main () -: 6:{ 1: 7: long a = 0x89ABCDEF; -: 8: 2: 9: if (f1(a)!=0x89000000L|| 2: 10: f2(a)!=0x00ABCDEFL|| 1: 11: f3(a)!=0x89AB0000L) #####: 12: return 1; 1: 13: return 0; -: 14:} #################################### Line 9 and Line 10 are wrongly marked as executed twice. (In debugger, it only hit once.) I am not sure whether this one is a duplication of bug #97923. The only difference is that this one is a function call and the "||" is placed different with bug #97923.