public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/101192] New: [GCOV] The coverage of a callee function goes wrong.
@ 2021-06-24 11:58 njuwy at smail dot nju.edu.cn
  2021-07-02  7:17 ` [Bug gcov-profile/101192] " marxin at gcc dot gnu.org
  2021-08-13 10:36 ` njuwy at smail dot nju.edu.cn
  0 siblings, 2 replies; 3+ messages in thread
From: njuwy at smail dot nju.edu.cn @ 2021-06-24 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101192
           Summary: [GCOV] The coverage of a callee function goes wrong.
           Product: gcc
           Version: 10.2.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
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++
-disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)

$ cat test.c
#include<stdio.h>
#include<stdlib.h>
char a[] = "12345";
char b[] = "12345";

void loop(char *pz, char *pzDta) {
  for (;;) {
    switch (*(pz++) = *(pzDta++)) {
    case 0:
      goto loopDone2;

    case '"':
    case '\\':
      pz[-1] = '\\';
      *(pz++) = pzDta[-1];
    }
  }
loopDone2:;

  if (a - pz != b - pzDta)
    abort();
}

int main() {
  loop(a, b);
  exit(0);
}

$ gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov
libgcov profiling error:/home/wangyang/coverage/test/test.gcda:overwriting an
existing profile data with a different timestamp
File 'test.c'
Lines executed:71.43% of 14
Creating 'test.c.gcov'

        -:    0:Source:test.c
        -:    0:Graph:test.gcno
        -:    0:Data:test.gcda
        -:    0:Runs:1
        -:    1:#include<stdio.h>
        -:    2:#include<stdlib.h>
        -:    3:char a[] = "12345";
        -:    4:char b[] = "12345";
        -:    5:
        6:    6:void loop(char *pz, char *pzDta) {
        -:    7:  for (;;) {
        6:    8:    switch (*(pz++) = *(pzDta++)) {
        1:    9:    case 0:
        1:   10:      goto loopDone2;
        -:   11:
    #####:   12:    case '"':
        -:   13:    case '\\':
    #####:   14:      pz[-1] = '\\';
    #####:   15:      *(pz++) = pzDta[-1];
        -:   16:    }
        -:   17:  }
        1:   18:loopDone2:;
        -:   19:
        1:   20:  if (a - pz != b - pzDta)
    #####:   21:    abort();
        1:   22:}
        -:   23:
        1:   24:int main() {
        1:   25:  loop(a, b);
        1:   26:  exit(0);
        -:   27:}

Lets see line 6, "loop" function was only executed once.

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

* [Bug gcov-profile/101192] [GCOV] The coverage of a callee function goes wrong.
  2021-06-24 11:58 [Bug gcov-profile/101192] New: [GCOV] The coverage of a callee function goes wrong njuwy at smail dot nju.edu.cn
@ 2021-07-02  7:17 ` marxin at gcc dot gnu.org
  2021-08-13 10:36 ` njuwy at smail dot nju.edu.cn
  1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-07-02  7:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-02
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, we are unlucky as ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb is shared
in by the loop and function entry.

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

* [Bug gcov-profile/101192] [GCOV] The coverage of a callee function goes wrong.
  2021-06-24 11:58 [Bug gcov-profile/101192] New: [GCOV] The coverage of a callee function goes wrong njuwy at smail dot nju.edu.cn
  2021-07-02  7:17 ` [Bug gcov-profile/101192] " marxin at gcc dot gnu.org
@ 2021-08-13 10:36 ` njuwy at smail dot nju.edu.cn
  1 sibling, 0 replies; 3+ messages in thread
From: njuwy at smail dot nju.edu.cn @ 2021-08-13 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Yang Wang <njuwy at smail dot nju.edu.cn> ---
*** Bug 101623 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-08-13 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 11:58 [Bug gcov-profile/101192] New: [GCOV] The coverage of a callee function goes wrong njuwy at smail dot nju.edu.cn
2021-07-02  7:17 ` [Bug gcov-profile/101192] " marxin at gcc dot gnu.org
2021-08-13 10:36 ` njuwy at smail dot nju.edu.cn

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).