volatile semantics

Daniel Berlin dberlin@dberlin.org
Sun Jul 17 14:33:00 GMT 2005


On Sun, 2005-07-17 at 08:18 +0300, Michael Veksler wrote:
> 
> 
> 
> Gabriel Dos Reis wrote on 17/07/2005 06:07:29:
> 
> > Daniel Berlin <dberlin@dberlin.org> writes:
> >
> > | Anything it sees anything in a statement with volatile, it marks the
> > | statement as volatile, which should stop things from touching it
> > | (anything that *does* optimize something marked volatile is buggy).
> > great!
> >
> 
> I can't agree with that as is. I would refine it to:
>   Anything that *does* optimizes away visible reads or writes of
>   something marked volatile is buggy.

Fine.
But the tree optimizers currently make no distinction between reads and
writes of volatile operands, or even which operands of a statement are
volatile and which are not.  So from the perspective of what we do
*now*, what i said is completely correct, because the optimizers do not
(not "can not") distinguish to the level you want.

I'd also guess it's probably not worth doing so, but i may be wrong.





More information about the Gcc mailing list