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 06/08/2010 08:50 PM, Jakub Jelinek wrote:
But what if gcc -fwhole-program -fsmart-opt figures out that thread_func is
only ever used as a thread function called by ptread_create and therefore
argument passed to it can't reference&a and thus p != q can be optimized as
1?

Or in Jack's code,


  __thread int a;
  int *pa;
  ...
  int main()
  {
     pa = &a;
     ...
  }

it doesn't even take such a smart optimizer:

1) With -fwhole-program pa is effectively static.

2) it also does not escape, so its definition can be propagated to use points.

... hence effectively you are back without the change you made. Iain, can you please add volatile as suggested by Jakub (i.e. int *volatile)?

Thanks!

Paolo


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