On 08/04/2016 04:48 PM, Nathan Sidwell wrote:
> diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
> +static inline void
> +__gcov_one_value_profiler_body_atomic (gcov_type *counters, gcov_type value)
> +{
> ...
> 
> The body looks to have data races.  Some kind of cmp_store needed on 
> counters[1]?  Maybe it can't be completely race free?
> 
> nathan

You are right, as we would need to atomically change 2 values (counters[0] and 
counters[1]),
it's impossible IMHO. It's question what to do with that:

1) atomically update just counters[2] and live with data racing for the first 2 
values
2) add (probably conditionally) a spin lock
3) do not handle thread-safety of indirect call counters at all

Thoughts?
Martin

Reply via email to