On 21/03/2015 16:44, Peter Maydell wrote: > On 21 March 2015 at 15:34, Paolo Bonzini <pbonz...@redhat.com> wrote: >> 32-bit PPC cannot do atomic operations on long long. Inside the loops, >> we are already using local counters that are summed at the end of >> the run---with one exception in rcu_read_stress_test: fix it to use >> the same technique. Then, use a mutex to protect the global counts. >> Performance does not matter there because every thread will only enter >> the critical section once. >> >> Remaining uses of atomic instructions are for ints or pointers. > > I don't suppose there's a way to make the atomic functions > enforce that 'not for anything that larger than pointer type', > is there? It would be nice if this kind of bug caused compile > failures on all 32-bit systems rather than only ppc-32...
Yes, it should be possible (e.g. with __builtin_choose_expr or with a statement expression that includes QEMU_BUILD_BUG_ON). Paolo