public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/97925] New: [GCOV]incorrect code coverage for function call for when multiple Logical OR expressions of a "if" statement in different lines
@ 2020-11-20 3:27 yangyibiao at outlook dot com
2020-11-20 9:40 ` [Bug gcov-profile/97925] " marxin at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: yangyibiao at outlook dot com @ 2020-11-20 3:27 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug gcov-profile/97925] [GCOV]incorrect code coverage for function call for when multiple Logical OR expressions of a "if" statement in different lines
2020-11-20 3:27 [Bug gcov-profile/97925] New: [GCOV]incorrect code coverage for function call for when multiple Logical OR expressions of a "if" statement in different lines yangyibiao at outlook dot com
@ 2020-11-20 9:40 ` marxin at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-20 9:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97925
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2020-11-20
Status|UNCONFIRMED |NEW
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, there's a bad location for _2 = ...
<bb 3> :
[pr97925.c:10:7] _2 = f2 (a_7);
[pr97925.c:9:25] if (_2 != 11259375)
goto <bb 5>; [INV]
else
goto <bb 4>; [INV]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-20 9:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 3:27 [Bug gcov-profile/97925] New: [GCOV]incorrect code coverage for function call for when multiple Logical OR expressions of a "if" statement in different lines yangyibiao at outlook dot com
2020-11-20 9:40 ` [Bug gcov-profile/97925] " marxin at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).