http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52839
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.7.1 --- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-10 15:58:35 UTC --- In brief: in ext/concurrence.h we set __default_lock_policy to _S_atomic if we have 2-byte and 4-byte CAS, which is true for powerpc. but in ext/atomicity.h we fallback to a mutex unless we have 2-byte, 4-byte *and* 8-byte CAS, and there is no 8-byte CAS on powerpc. The fix isn't so brief: Ideally the ext/atomicity.h code should not require 8-byte CAS. If we had a _GLIBCXX_ATOMIC_BUILTINS_WORD that indicated atomics work for 'int' then we could use that in both ext/atomicity.h and ext/concurrence.h and then they'd be consistent, ensuring we don't mix atomics with mutexes ... *but* then powerpc would stop using a mutex to implement refcounts in libstdc++ and because those functions are inlined that would prevent mixing code built with old and new libstdc++ which is not acceptable. So I think the right fix is to set __default_lock_policy = _S_mutex when we don't have 8-byte CAS, i.e. make it also depend on _GLIBCXX_ATOMIC_BUILTINS. We could potentially add a --enable-libstdcxx-atomic-word switch that would change the ABI so powerpc could use atomic builtins for refcounts, then make that the default when we change the libstdc++ SONAME.