This is the mail archive of the gcc-help@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: Optimization of conditional access to globals: thread-unsafe?


> From: "Dave Korn" <dave.korn@artimi.com>
> Date: Mon, 29 Oct 2007 01:16:07 -0000
> 
> >   Thing is, if you disable all optimisations that are potentially
> > unsafe in the presence of threads, won't you just get the same
> > effect as if you had used volatile anyway, only on every single
> > variable in the program instead of just the ones the programmer has
> > designated as sensitive?
> 
> This is not really what is being suggested at all.
> 
> The compiler simply cannot speculatively load or store to variables
> with global visibility.

Any optimization is good, and GCC's is great, though debugging it is hell,
and I do not see the problem with an option to turn off somebody's pet
feature when I need to.

It really is up to the programmer to decide how the program behaves, not a 
standards committee.

Just my 0.02, again.


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