On Mon, Feb 27, 2012 at 6:29 PM, Aldy Hernandez <al...@redhat.com> wrote: > On 02/27/12 11:02, Michael Matz wrote: >> >> Hi, >> >> On Mon, 27 Feb 2012, Aldy Hernandez wrote: >> >>> >>>>> For that matter, didn't rth add a memory barrier at the beginning of >>>>> transactions last week? That would mean that we can't hoist anything >>>>> outside of a transaction anyhow. Or was it not a full memory barrier? >>>> >>>> >>>> It's now a full memory barrier for all global memory and for local >>>> statics >>>> if their address is taken (and for automatic vars with their address >>>> taken). >>>> Do we need to be concerned about non-address-taken local statics? >>> >>> >>> It is my understanding that non-address-taken local statics are not >>> visible to other threads, >> >> >> void f () { static int i; i++; } >> >> Running 'f' in different threads will expose the storage to 'i' to each of >> them without taking its address :-/ > > > In that case, shouldn't we make transactions barriers for local statics as > well, regardless of if their address was taken or not?
We don't have a convenient bit for this right now, but OTOH we assume that the transaction may re-enter the function, and thus it should already be a barrier for local statics. Unless the builtins have the "leaf" attribute on them. Richard.