This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, toplevel/config] fix tls.m4 configure race condition (bootstrap/PR43170)


On Tue, Jun 08, 2010 at 07:10:58PM +0200, Paolo Bonzini wrote:
> >Is volatile required here because we want to peek behind implementation
> >details that are not supposed to be observable, and observable features
> >of threads don't need them?
> 
> In "int volatile *volatile"
>         ^^^^^^^^  ^^^^^^^^
>   This one is to  This one is probably superfluous.
>    ensure emutls  You could also remove the * in
>   get_address is  the second line.
>          called.

The first volatile isn't needed.  That affects accesses to a, but that is
something that doesn't happen in the program at all.

The second volatile is what might be needed (as alternative to making
it a global) - to make sure a_in_main_thread = &a; isn't moved across the
pthread_create call which for an automatic variable is possible (similarly
how
int i;

int *foo (void)
{
  int *p = &i;
  bar ();
  return p;
}
could be optimized into int *foo (void) { bar (); return &i; }.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]