https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71945

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> The __atomic_fetch_add built-in on signed integers is required to wrap like
> unsigned integers without UB, but we should check that all our
> target-specific implementations of __exchange_and_add (and
> __exchange_and_add_single) have that property too.

We also need to make sure that the _Sp_counted_base<_S_single> specialization
which uses plain non-atomic increments and decrements uses unsigned arithmetic
to be free of UB when going from INT_MAX to INT_MIN.

Reply via email to