Optimization of conditional access to globals: thread-unsafe?
Robert Dewar
dewar@adacore.com
Sun Oct 28 13:53:00 GMT 2007
Bart Van Assche wrote:
> My opinion is that, given the importance of multithreading, it should
> be documented in the gcc manual which optimizations can cause trouble
> in multithreaded software (such as (3) and (4)). It should also be
> documented which compiler flags must be used to disable optimizations
> that cause trouble for multithreaded software. Requiring that all
> thread-shared variables should be declared volatile is completely
> unacceptable.
Why is this unacceptable .. seems much better to me than writing
undefined stuff.
> And as you may have noted, I do not agree with Hans Boehm where he
> states that the combination of C/C++ with POSIX threads cannot result
> in correctly working programs. I believe that the issues raised by
> Hans Boehm can be solved.
Well Hans is talking about C/C++, you are talking about some other
language in which programs which do not have well defined semantics
in C or C++ do have well defined semantics in your language.
>
> Bart Van Assche.
More information about the Gcc
mailing list