Thanks for putting me in CC, Paul. I think the two issues are only superficially related - atomics in a Gnulib environment and the future of the hamt module.
As for the latter, if the cost is not too high, I would like to see that hamt continues to be available alongside the other data structure modules in Gnulib (like hash tables or the various list modules). Potentially, I think a lot of programs could benefit from it (because it is one of the very few (if any) persistent data structure modules in Gnulib, which make taking snapshots very cheap, for example), so it may be a problem of advertising. As for the former, I won't be able to chime in right now because it is currently vacation time for me and I am mostly on the road. Best, Marc Am Di., 11. Aug. 2026 um 09:11 Uhr schrieb Paul Eggert <[email protected]>: > On 2026-08-09 07:52, Arsen Arsenović wrote: > > 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 took a look at the only Gnulib module that uses _Atomic, namely hamt. It > uses _Atomic in the way you suggest, i.e., use _Atomic only on a best > effort basis. Unfortunately I found two problems with how hamt uses > _Atomic. First, it misspelled __STDC_NO_ATOMICS__, a bug that nobody has > reported since hamt was added to Gnulib in 2021. Second, hamt worried only > about GCC and Clang, I suppose under the theory it wasn't worth > investigating which other compilers supported _Atomic. > > I attempted to fix these problems by installing the attached patches. > Still, this is dicey, as with older platforms one might need to compile > with special options. For example, on Solaris 10 sparc when compiling with > Oracle Developer Studio 12.6, one now needs to compile with 'cc > -xatomic=studio' to get hamt to work. It's a bit of a mess dealing with > these old platforms, a mess that I suppose old-platform builders will have > to deal with somehow. > > Luckily, Gnulib's hamt module is so rarely used that this isn't much of a > practical problem. Still, it appears that using _Atomic is dicey, at least > in the Gnulib world which ports to older platforms. It's not clear to me > whether or when Gnulib-using code should use _Atomic instead of Gnulib's > simple-atomic module, for example. > > Come to think of it, should we remove the hamt module from Gnulib? As I > vaguely recall it was added under the theory that some package might find > it useful, but it's been five years now, and as far as I know nobody is > using it. I'll cc this to its original contributor Marc Nieper-Wißkirchen > to give him a heads-up about the situation, and am retitling this email's > subject line accordingly.
