public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/100980] New: [GCOV]The assignment statement in the “for” structure caused the wrong coverage
@ 2021-06-09  3:10 njuwy at smail dot nju.edu.cn
  2021-06-10 14:50 ` [Bug gcov-profile/100980] " marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: njuwy at smail dot nju.edu.cn @ 2021-06-09  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100980
           Summary: [GCOV]The assignment statement in the “for” structure
                    caused the wrong coverage
           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>
extern void abort(void);
extern void exit(int);
int main(void) {
  struct foo{
     int i0;
};
  int b,c,d=1;
  for ((b = sizeof(struct foo {
          int i0;
          int i1;
        }));
       d; d--)
c = sizeof(struct foo);
}

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

        -:    0:Source:test.c
        -:    0:Graph:test.gcno
        -:    0:Data:test.gcda
        -:    0:Runs:1
        -:    1:#include<stdio.h>
        -:    2:extern void abort(void);
        -:    3:extern void exit(int);
        1:    4:int main(void) {
        -:    5:  struct foo{
        -:    6:     int i0;
        -:    7:};
        1:    8:  int b,c,d=1;
        2:    9:  for ((b = sizeof(struct foo {
        -:   10:          int i0;
        -:   11:          int i1;
        -:   12:        }));
        1:   13:       d; d--)
        1:   14:c = sizeof(struct foo);
        -:   15:}


line 9 was wrongly marked as executed 2 times

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

end of thread, other threads:[~2022-07-04 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  3:10 [Bug gcov-profile/100980] New: [GCOV]The assignment statement in the “for” structure caused the wrong coverage njuwy at smail dot nju.edu.cn
2021-06-10 14:50 ` [Bug gcov-profile/100980] " marxin at gcc dot gnu.org
2022-06-14 12:46 ` njuwy at smail dot nju.edu.cn
2022-06-14 15:46 ` njuwy at smail dot nju.edu.cn
2022-07-04 12:16 ` njuwy at smail dot nju.edu.cn
2022-07-04 12:23 ` marxin at gcc dot gnu.org
2022-07-04 12:23 ` 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).