Re: atomic_thread_fence() semantics

2017-10-21 Thread Torvald Riegel
On Fri, 2017-10-20 at 18:46 +0300, Alexander Monakov wrote: > On Fri, 20 Oct 2017, Torvald Riegel wrote: > > On Thu, 2017-10-19 at 15:31 +0300, Alexander Monakov wrote: > > > On Thu, 19 Oct 2017, Andrew Haley wrote: > > > > No, you did not. This looks like a bug. Please report it. > > > > > > Th

Re: atomic_thread_fence() semantics

2017-10-20 Thread Alexander Monakov
On Fri, 20 Oct 2017, Torvald Riegel wrote: > On Thu, 2017-10-19 at 15:31 +0300, Alexander Monakov wrote: > > On Thu, 19 Oct 2017, Andrew Haley wrote: > > > No, you did not. This looks like a bug. Please report it. > > > > This bug is fixed on trunk, so should work from gcc-8 onwards (PR 80640).

Re: atomic_thread_fence() semantics

2017-10-20 Thread Torvald Riegel
On Fri, 2017-10-20 at 12:47 +0200, Torvald Riegel wrote: > On Thu, 2017-10-19 at 13:58 +0200, Mattias Rönnblom wrote: > > Hi. > > > > I have this code: > > > > #include > > > > int ready; > > int message; > > > > void send_x4711(int m) { > > message = m*4711; > > atomic_thread_fence(

Re: atomic_thread_fence() semantics

2017-10-20 Thread Torvald Riegel
On Thu, 2017-10-19 at 13:18 +0100, Andrew Haley wrote: > On 19/10/17 13:10, Jonathan Wakely wrote: > > There are no atomic operations on atomic objects here, so the fence > > doesn't synchronize with anything. > > Really? This seems rather unhelpful, to say the least. > > An atomic release opera

Re: atomic_thread_fence() semantics

2017-10-20 Thread Torvald Riegel
On Thu, 2017-10-19 at 15:31 +0300, Alexander Monakov wrote: > On Thu, 19 Oct 2017, Andrew Haley wrote: > > On 19/10/17 12:58, Mattias Rönnblom wrote: > > > Did I misunderstand the semantics of > > > atomic_thread_fence+memory_order_release? > > > > No, you did not. This looks like a bug. Please

Re: atomic_thread_fence() semantics

2017-10-20 Thread Torvald Riegel
On Thu, 2017-10-19 at 13:58 +0200, Mattias Rönnblom wrote: > Hi. > > I have this code: > > #include > > int ready; > int message; > > void send_x4711(int m) { > message = m*4711; > atomic_thread_fence(memory_order_release); > ready = 1; > } > > When I compile it with GCC 7.2 -O

Re: atomic_thread_fence() semantics

2017-10-19 Thread Andrew Haley
On 19/10/17 14:04, Sebastian Huber wrote: > On 19/10/17 14:18, Andrew Haley wrote: >> On 19/10/17 13:10, Jonathan Wakely wrote: >>> There are no atomic operations on atomic objects here, so the fence >>> doesn't synchronize with anything. >> Really? This seems rather unhelpful, to say the least. >

Re: atomic_thread_fence() semantics

2017-10-19 Thread Sebastian Huber
On 19/10/17 14:18, Andrew Haley wrote: On 19/10/17 13:10, Jonathan Wakely wrote: There are no atomic operations on atomic objects here, so the fence doesn't synchronize with anything. Really? This seems rather unhelpful, to say the least. An atomic release operation X in thread A synchronizes

Re: atomic_thread_fence() semantics

2017-10-19 Thread Mattias Rönnblom
On 2017-10-19 14:31, Alexander Monakov wrote: On Thu, 19 Oct 2017, Andrew Haley wrote: On 19/10/17 12:58, Mattias Rönnblom wrote: Did I misunderstand the semantics of atomic_thread_fence+memory_order_release? No, you did not. This looks like a bug. Please report it. This bug is fixed on t

Re: atomic_thread_fence() semantics

2017-10-19 Thread Alexander Monakov
On Thu, 19 Oct 2017, Andrew Haley wrote: > On 19/10/17 12:58, Mattias Rönnblom wrote: > > Did I misunderstand the semantics of > > atomic_thread_fence+memory_order_release? > > No, you did not. This looks like a bug. Please report it. This bug is fixed on trunk, so should work from gcc-8 onwar

Re: atomic_thread_fence() semantics

2017-10-19 Thread Andrew Haley
On 19/10/17 13:10, Jonathan Wakely wrote: > There are no atomic operations on atomic objects here, so the fence > doesn't synchronize with anything. Really? This seems rather unhelpful, to say the least. An atomic release operation X in thread A synchronizes-with an acquire fence F in thread B,

Re: atomic_thread_fence() semantics

2017-10-19 Thread Andrew Haley
On 19/10/17 12:58, Mattias Rönnblom wrote: > I have this code: > > #include > > int ready; > int message; > > void send_x4711(int m) { > message = m*4711; > atomic_thread_fence(memory_order_release); > ready = 1; > } > > When I compile it with GCC 7.2 -O3 -std=c11 on x86_64 it p

Re: atomic_thread_fence() semantics

2017-10-19 Thread Jonathan Wakely
On 19 October 2017 at 12:58, Mattias Rönnblom wrote: > Hi. > > I have this code: > > #include > > int ready; > int message; > > void send_x4711(int m) { > message = m*4711; > atomic_thread_fence(memory_order_release); > ready = 1; > } > > When I compile it with GCC 7.2 -O3 -std=c11 on

atomic_thread_fence() semantics

2017-10-19 Thread Mattias Rönnblom
Hi. I have this code: #include int ready; int message; void send_x4711(int m) { message = m*4711; atomic_thread_fence(memory_order_release); ready = 1; } When I compile it with GCC 7.2 -O3 -std=c11 on x86_64 it produces the following code: send_x4711: .LFB0: .LVL0: imu