Bruno Haible <[email protected]> writes:

> When I build packages that need the Boehm GC package, on some of my
> target machines it still needs a prior installation of the 'libatomic'
> package, because without it, the compiler's support for atomic types
> is insufficient.

Do you mean libatomic_ops?  libatomic has nothing to do with
language-level atomic operations, and it is part of GCC.

> Atomic types can't be emulated in Gnulib, because it's the compiler
> which decides which instruction sequences to use for loads and stores.

I see the simple-atomic gnulib module.  It could be extended to support
the case of relaxed load/store and used here.

> The point is portability. _Atomic was introduced in ISO C11; however,
> Gnulib assumes C99 only.

I think one should not add bugs to most systems (which can use atomic or
sync builtins, or even standard atomic operations), for sake of a few
platforms that lack any of them.

To use relaxed atomics is also not a slowdown here, unless the system
requires special operations for atomics of the corresponding size.  In
which case, not using atomics is an actualized (rather than latent) bug.

Alternatively, one could just cross their fingers on platforms lacking
stdatomic, since the odds of the bug actually manifesting observably is
quite low, and use stdatomic only a best effort basis - i.e. use it if
present, and have no atomic handling (as is the case today) otherwise.

I also doubt 'volatile' suffices (rather, I see no reason why it ought
to).
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature

Reply via email to