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]
Other format: [Raw text]

Re: Why doesn't combine like volatiles? (volatile_ok again, sorry!)


Robert Dewar wrote:
Richard Earnshaw wrote:

Possibly, but I think the more interesting observation is listed in
parenthesis: Can a volatile access ever alias a non-volatile access?

I think the answer is no, Certainly Ada has compile time rules carefully written to make this impossible.

Usually I try to avoid the realm of "hypotetical targets" and hypotetical optimizations, but I can imagine a target where one bit of a register needs to be accessed in a volatile way and the others need not.


Then, I don't know if it would be legal to optimize

  struct r {
    unsigned int x : 7;
    volatile unsigned int y : 1;
  };

struct r my_reg;

So that my_reg.x is accessed with a non-volatile mem, and my_reg.y is accessed with a volatile one. Would such an optimization be possible within the Ada compile-time rules?

Paolo


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