Am Sonntag, den 07.11.2021, 10:24 +0100 schrieb Florian Weimer:
> * Martin Uecker via Gcc:
> 
> > 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.
> 
> GCC should probably warn about this, and ensure that objects declared
> _Atomic have increased alignment.  But adding run-time checks to all
> atomic accesses does not make sense.  We want to move user code away
> from bespoke atomics implementations, and this would be contrary to that
> goal.

You do not build trust in your API if you silently
create incorrect code.  

If the alignment is sufficient as guaranteed by the
type, clang also does not use a run-time check.


Martin




Reply via email to