Re: atomic_load

2021-11-08 Thread Jonathan Wakely via Gcc
On Sun, 7 Nov 2021, 09:08 Martin Uecker wrote:

>
> It would be great if somebody could take a look at
> PR96159.
>
> It seems we do not do atomic accesses correctly
> when the alignment is insufficient for a lockfree
> access, but I think we should fall back to a
> library call in this case (as clang does).
>
> This is very unfortunate as it is an important
> functionality to be able to do atomic accesses
> on non-atomic types and it seems there is no way
> to achieve this.
>

C++ solves this with std::atomic_ref which has a precondition that the
non-atomic object being operated on is suitably aligned. Working with
arbitrary objects is not supported, the user must ensure the alignment is
correct.

That seems like a reasonable restriction to me.


Re: atomic_load

2021-11-08 Thread Martin Uecker via Gcc
Am Montag, den 08.11.2021, 11:59 + schrieb Jonathan Wakely:
> On Sun, 7 Nov 2021, 09:08 Martin Uecker wrote:
> 
> > It would be great if somebody could take a look at
> > PR96159.
> > 
> > It seems we do not do atomic accesses correctly
> > when the alignment is insufficient for a lockfree
> > access, but I think we should fall back to a
> > library call in this case (as clang does).
> > 
> > This is very unfortunate as it is an important
> > functionality to be able to do atomic accesses
> > on non-atomic types and it seems there is no way
> > to achieve this.
> > 
> 
> C++ solves this with std::atomic_ref which has a precondition that the
> non-atomic object being operated on is suitably aligned.

>  Working with
> arbitrary objects is not supported, the user must ensure the alignment is
> correct.
> 
> That seems like a reasonable restriction to me.

It is in so far not reasonable as you can not use atomic
operations safely on existing data structures, but
this is an important requirement in some applications.

And it would trivial to support just by calling into
libatomic as clang does.

Martin






How to get started with contribution

2021-11-08 Thread Anmol Singh via Gcc
Respected Sir/Madam,
I am Anmol Singh, an Information Technology undergrad. I have just entered
my second year at  ADGITM, IP University. I am new to open source
contributions but I am well aware of C++,C and javascript. I would love to
contribute to your organisation but could you please tell me how to get
started?
Regards
Anmol