https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93754
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- But it's actually called twice. The second invocation is from libgcov: #0 free (ptr=0x606280) at t.c:3 #1 0x00002aaaaad41d8e in _IO_new_fclose (fp=0x606280) at iofclose.c:84 #2 0x000000000040139e in __gcov_close () at /space/rguenther/src/svn/gcc-9-branch/libgcc/../gcc/gcov-io.c:212 #3 0x0000000000401b59 in dump_one_gcov (run_max=1, run_counted=0, gf=<synthetic pointer>, gi_ptr=<optimized out>) at /space/rguenther/src/svn/gcc-9-branch/libgcc/libgcov-driver.c:545 #4 gcov_do_dump (list=<optimized out>, run_counted=0) at /space/rguenther/src/svn/gcc-9-branch/libgcc/libgcov-driver.c:584 #5 0x00000000004025e0 in __gcov_dump_one (root=0x6042c0 <__gcov_root>) at /space/rguenther/src/svn/gcc-9-branch/libgcc/libgcov-driver.c:607 #6 __gcov_dump_one (root=0x6042c0 <__gcov_root>) at /space/rguenther/src/svn/gcc-9-branch/libgcc/libgcov-driver.c:602 #7 __gcov_exit () at /space/rguenther/src/svn/gcc-9-branch/libgcc/libgcov-driver.c:623 #8 0x0000000000400e0e in _GLOBAL__sub_D_00100_1_free () at t.c:15 #9 0x00002aaaaaabb2b3 in _dl_fini () at dl-fini.c:235 #10 0x00002aaaaad0bd78 in __run_exit_handlers (status=1, listp=0x2aaaab0876f8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:83 #11 0x00002aaaaad0bdca in __GI_exit (status=<optimized out>) at exit.c:105 #12 0x00002aaaaacf3f91 in __libc_start_main (main=0x400dac <main>, argc=1, argv=0x7fffffffdd98, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd88) at ../csu/libc-start.c:342 #13 0x0000000000400cca in _start () at ../sysdeps/x86_64/start.S:120 your 'free' function interposes the one from libc.