GNOME Bugzilla – Bug 692583
atomic get doesn't accept a const argument on architectures where it isn't lock-free
Last modified: 2013-01-28 11:52:54 UTC
The macro implementation of g_atomic_pointer_get() will happily dereference a "const volatile void *", with no warnings or errors. However, the function implementation takes a "volatile void *", so it's invalid (normally a warning in C or an error in C++) to pass the same pointer to it. This can result in code that doesn't specifically rely on lock-free operations, compiles perfectly well on platforms that have lock-free operations, but doesn't compile on platforms that don't; in particular, sigx didn't compile on Debian armel, which is armv4t. <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699021> As far as I can see, g_atomic_int_get() has the same issue.
Created attachment 234483 [details] [review] g_atomic_int_get, g_atomic_pointer_get: accept const arguments --- ... and a regression test for the same. Tested on Linux, also compiled-but-not-tested for i686-w64-mingw32 (32-bit Windows).
Review of attachment 234483 [details] [review]: Thanks, looks good
Thanks, fixed in git for 2.35.5, commit cf68300d27784ab5baaf6ef4761cead0ec404b1f.