[BUILDROBOT] avr broken (was: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch)

2016-08-13 Thread Jan-Benedict Glaw
On Fri, 2016-08-05 15:43:02 +0200, Martin Liška wrote: [...] > Great, attaching install candidate. > >From 0b3ac8636ef34b02e301f22c86dde0602f9969ef Mon Sep 17 00:00:00 2001 > From: marxin > Date: Thu, 28 Jul 2016 14:32:47 +0200 > Subject: [PATCH 1/4] Cherry-pick fprofile-ge

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-10 Thread Nathan Sidwell
On 08/05/16 09:43, Martin Liška wrote: On 08/05/2016 03:14 PM, Nathan Sidwell wrote: On 08/05/16 08:48, Martin Liška wrote: Ok, after all the experimenting and inventing "almost" thread-safe code, I incline to not to include __gcov_one_value_profiler_body_atomic counter. The final solution is

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-05 Thread Martin Liška
agree, I'll prepare a final version of patch? > > Agreed. > > nathan > Great, attaching install candidate. Martin >From 0b3ac8636ef34b02e301f22c86dde0602f9969ef Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 28 Jul 2016 14:32:47 +0200 Subject: [PATCH 1/4] Cherry-pick f

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-05 Thread Nathan Sidwell
On 08/05/16 08:48, Martin Liška wrote: Ok, after all the experimenting and inventing "almost" thread-safe code, I incline to not to include __gcov_one_value_profiler_body_atomic counter. The final solution is cumbersome and probably does not worth doing. Moreover, even having a thread-safe imp

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-05 Thread Martin Liška
On 08/05/2016 02:38 PM, Nathan Sidwell wrote: > On 08/05/16 04:55, Martin Liška wrote: > >> Thank you for very intensive brainstorming ;) Well I still believe that >> following code >> is not thread safe, let's image following situation: >> > > yeah, you're right. > >>> we could do better by us

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-05 Thread Nathan Sidwell
On 08/05/16 04:55, Martin Liška wrote: Thank you for very intensive brainstorming ;) Well I still believe that following code is not thread safe, let's image following situation: yeah, you're right. we could do better by using compare_exchange storing value, and detect the race I mentione

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-05 Thread Martin Liška
On 08/04/2016 07:03 PM, Nathan Sidwell wrote: > On 08/04/16 12:43, Nathan Sidwell wrote: > >> How about: >> gcov_t expected; >> atomic_load (&counter[0], val, ...); >> gcov_t delta = val == value ? 1 : -1; >> atomic_add (&counter[1], delta); <-- or atomic_add_fetch >> if (delta < 0) { >> /* c

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-04 Thread Nathan Sidwell
On 08/04/16 12:43, Nathan Sidwell wrote: How about: gcov_t expected; atomic_load (&counter[0], val, ...); gcov_t delta = val == value ? 1 : -1; atomic_add (&counter[1], delta); <-- or atomic_add_fetch if (delta < 0) { /* can we set counter[0]? */ atomic_load (&counter[1], &expected, ...);

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-04 Thread Nathan Sidwell
On 08/04/16 11:34, Martin Liška wrote: 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. So

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-04 Thread Martin Liška
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

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-04 Thread Nathan Sidwell
On 08/01/16 09:29, Martin Liška wrote: I also added a small hunk that describes problematic of app having not-joined (or detached) threads, can you please take a look at documentation change, maybe it would need some transformation? sorry for the tady response,thanks for the ping. In genera

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-01 Thread Martin Liška
tunningly similar. Fixed. I also added a small hunk that describes problematic of app having not-joined (or detached) threads, can you please take a look at documentation change, maybe it would need some transformation? Martin > > nathan >From 7e19e28f3d6e227bb67fb770575831d637abe3a

Re: [PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-01 Thread Nathan Sidwell
As I just wrote, this patch needs work. the general points are: 1) exposing integers 0-3 to the user as switch values. Don't do that, give them names. In this case a comma separated list of orthogonal names seems appropriate. But see below. 2) Poor documentation. How might the user might

[PATCH 1/4] Cherry-pick fprofile-generate-atomic from google/gcc-4_9 branch

2016-08-01 Thread marxin
libgcc/ChangeLog: 2016-07-28 Martin Liska * Makefile.in: Add functions to LIBGCOV_PROFILER. * libgcov-profiler.c (__gcov_one_value_profiler_body_atomic): New function. (__gcov_one_value_profiler_atomic): Likewise. (__gcov_indirect_call_profiler_v2): Fix