[v3] atomics

David Daney ddaney@avtrex.com
Fri Apr 18 17:52:00 GMT 2008


Benjamin Kosnik wrote:
> This adds in experimental support for C++0x chapter 29, atomics. It is
> based on the sample implementation by Lawrence Crowl in N2427, who
> generously allowed libstdc++ use of this code. Thanks Lawrence!
> 

This patch badly breaks things on MIPS.

The problem is that MIPS only supports atomic operations on 32 bit wide 
locations (and 64 for mips64).  src/atomic.cc appears to be trying to 
generate code for operations on 8 bit wide locations thus generating 
calls to  __sync_lock_test_and_set_1 as the operation can not be 
expanded.  Since there is no __sync_lock_test_and_set_1 anything that 
links against libstdc++.so fails to link (most of the c++ and libstdc++ 
testsuite for example).


At this point I don't really have an opinion as to how to fix the 
problem.  One thought that comes to mind is to change the definition of 
atomic_flag so that the size of the atomic variable is appropriate for 
the target architecture (32 bits in the case of MIPS)

Thoughts?

Thanks,
David Daney



More information about the Libstdc++ mailing list