https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99485
--- Comment #2 from Yang Wang <njuwy at smail dot nju.edu.cn> --- (In reply to Martin Liška from comment #1) > > The result shows that function "free" was executed 5 times. > > Yes, the last 4 calls happen from libgcov run-time where memory is released: > > (gdb) bt > #0 free (ptr=0x4076f0) at pr99485.c:3 > #1 0x00007ffff7e426f3 in fclose@@GLIBC_2.2.5 () from /lib64/libc.so.6 > #2 0x0000000000401592 in __gcov_close () at > /home/marxin/Programming/gcc/libgcc/../gcc/gcov-io.c:212 > #3 0x0000000000401d10 in dump_one_gcov (run_max=1, run_counted=0, > gf=<synthetic pointer>, gi_ptr=0x405160) at > /home/marxin/Programming/gcc/libgcc/libgcov-driver.c:555 > #4 gcov_do_dump (list=<optimized out>, run_counted=0) at > /home/marxin/Programming/gcc/libgcc/libgcov-driver.c:594 > #5 0x0000000000402c34 in __gcov_dump_one (root=0x4052e0 <__gcov_root>) at > /home/marxin/Programming/gcc/libgcc/libgcov-driver.c:617 > #6 __gcov_dump_one (root=0x4052e0 <__gcov_root>) at > /home/marxin/Programming/gcc/libgcc/libgcov-driver.c:612 > #7 __gcov_exit () at > /home/marxin/Programming/gcc/libgcc/libgcov-driver.c:642 > #8 0x000000000040103d in _sub_D_00100_1 () at pr99485.c:15 > #9 0x00007ffff7fdc823 in _dl_fini () from /lib64/ld-linux-x86-64.so.2 > #10 0x00007ffff7e0ccf7 in __run_exit_handlers () from /lib64/libc.so.6 > #11 0x00007ffff7e0cea0 in exit () from /lib64/libc.so.6 > #12 0x00007ffff7df4b2c in __libc_start_main () from /lib64/libc.so.6 > #13 0x0000000000400ebe in _start () at ../sysdeps/x86_64/start.S:120 > > Then you see the function being executed twice. Later calls are not counted > as counters are already streamed into GCDA file. > Well, I tend to close it as invalid. Thank you. I got it.