public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/97921] New: [GCOV]inline function with an incremental argument lead to incorrect coverage
@ 2020-11-20  2:13 yangyibiao at outlook dot com
  2020-11-20  9:16 ` [Bug gcov-profile/97921] " marxin at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: yangyibiao at outlook dot com @ 2020-11-20  2:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97921
           Summary: [GCOV]inline function with an incremental argument
                    lead to incorrect coverage
           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
int v = 8;

__attribute__ ((noinline)) 
int foo(int x, ...)
{ return 0; }

extern inline __attribute__ ((always_inline, gnu_inline)) 
int bar(int x, ...)
{
  return foo(x);
}

int main()
{
  if (bar(0, ++v) != 0)
    return 1;
  return 0;
}

$ gcc -O0 --coverage test.c; ./a.out; gcov test.c; cat test.c.gcov
File 'test.c'
Lines executed:85.71% of 7
Creating 'test.c.gcov'

        -:    0:Source:test.c
        -:    0:Graph:test.gcno
        -:    0:Data:test.gcda
        -:    0:Runs:1
        -:    1:int v = 8;
        -:    2:
        -:    3:__attribute__ ((noinline)) 
        1:    4:int foo(int x, ...)
        1:    5:{ return 0; }
        -:    6:
        -:    7:extern inline __attribute__ ((always_inline, gnu_inline)) 
        -:    8:int bar(int x, ...)
        -:    9:{
        1:   10:  return foo(x);
        -:   11:}
        -:   12:
        1:   13:int main()
        -:   14:{
        2:   15:  if (bar(0, ++v) != 0)
    #####:   16:    return 1;
        1:   17:  return 0;
        -:   18:}


##########################
Line 15 is wrongly marked as executed 2 times.
When debug it in debugger and set breakpoint at Line 15, it only hit once.


$ gcc --version; gcov --version
gcc (GCC) 10.0.1 20200419 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcov (GCC) 10.0.1 20200419 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gcov-profile/97921] [GCOV]inline function with an incremental argument lead to incorrect coverage
  2020-11-20  2:13 [Bug gcov-profile/97921] New: [GCOV]inline function with an incremental argument lead to incorrect coverage yangyibiao at outlook dot com
@ 2020-11-20  9:16 ` 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:16 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 97919 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-20  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20  2:13 [Bug gcov-profile/97921] New: [GCOV]inline function with an incremental argument lead to incorrect coverage yangyibiao at outlook dot com
2020-11-20  9:16 ` [Bug gcov-profile/97921] " 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).