User account creation filtered due to spam.
__bb_exit_func is registered with atexit(), to save the profiling data.
I haven't analysed the situation in detail, but this appears to run before functions declared with __attribute__((destructor)), at least. So those don't get profiled (and, slightly more importantly, test coverage misses them).
(If this isn't fixed in the next release, it should probably be documented as a limitation and referenced from the gcov manual).
gcc version 3.2.1 20020830 (Debian prerelease)
could you confirm whether this behavior is still the case in gcc 3.3? A testcase of the
'unreliable' behavior would also be much apprecaited. Thanks,
The problem is that the write out for the data is done before global destructors are done.
I am not familiar with global destructors mechanizm, but can we assign each profiled file global destructor that will save profiles only for that file and manage priorities so they are run very last? That would solve this problem as well as the problem with profile being corrupted when dlclose is called...
*** Bug 16855 has been marked as a duplicate of this bug. ***
This bug *still* exists as of i686-apple-darwin10-g++-4.2.1. The problem is apparently the collision of two at_exit() handlers, with C++'s global destructor coming in last.
Date: Tue Sep 27 11:07:11 2016
New Revision: 240529
gcov: dump in a static dtor instead of in an atexit handler
* g++.dg/gcov/pr16855.C: New test.
* coverage.c (build_gcov_exit_decl): New function.
(coverage_obj_init): Call the function and generate __gcov_exit
* doc/gcov.texi: Document when __gcov_exit function is called.
* libgcov-driver.c (__gcov_init): Do not register a atexit
(__gcov_exit): Rename from gcov_exit.
* libgcov.h (__gcov_exit): Declare.
Fixed on trunk.