This is the mail archive of the gcc@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]

Re: Loop unrolling




On Sun, 7 Jun 1998, Jeffrey A Law wrote:

> 
>   In message <199806042119.OAA03778@atrus.synopsys.com>you write:
>   > > Why can't GCC go a step farther and honor the volatile attribute for
>   > > any auto object?  
>   > 
>   > Yes, if someone writes an automatic volatile variable, they've presumably d one
>   > so for a reason, so we should give them what they expect (don't optimize
>   > redundant reads and writes).
> Right.  Principle of least suprise.
> 
> IMHO, if I've stuck "volatile" on something, the optimizers should
> treat it as potentially changing at any time, regardless of the
> storage class of the object.

You are right.

By the way there is something we have been overlooking in these debates:
the possibility that a program might do something to clobber the cached
values of some objects, which necessitates reloading them from
the underlying storage.

This can even happen to auto objects whose address is never taken---the
obvious example is that of a longjmp which does not necessarily
restore the full machine context.

Thus volatile has to be honored on auto variables as well, however not
across code that cannot be interrupted by a setjmp/longjmp activity. :) 





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