This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gcov-profile/68080] gcov returns negative counts


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]