[Bug gcov-profile/68080] gcov returns negative counts
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 25 08:07:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Well, the test-case is very interesting as it exposes 2 issues:
1) Majority of instrumented profiling code is not thread-safe, for instance
edge profiler:
PROF_edge_counter_11 =
__gcov0._ZL20__gthread_mutex_lockP15pthread_mutex_t[0];
PROF_edge_counter_12 = PROF_edge_counter_11 + 1;
__gcov0._ZL20__gthread_mutex_lockP15pthread_mutex_t[0] =
PROF_edge_counter_12;
2) As the test-case does not properly join created threads and original thread
reaches gcov_exit, we get messed profile. One thread is writing to disk while
the others are still modifying counters.
I'm going to discuss the aforementioned problem on GCC mailing list.
More information about the Gcc-bugs
mailing list