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

[Bug c/12826] Optimizer removes reference through volatile pointer


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12826



------- Additional Comments From falk dot hueffner at student dot uni-tuebingen dot de  2003-10-29 17:11 -------
Subject: Re:  Optimizer removes reference through volatile pointer

"lee at bustech dot com" <gcc-bugzilla@gcc.gnu.org> writes:

> > ... you are accessing a non-volatile object through a pointer to a
> > volatile char. That doesn't change the non-volatility of the
> > object
> 
> But it does change the object's volatility to change the assignment of "*sp =
> 0xE8" to "* (volatile char *) sp = 0xE8". Gcc should at least be consistent
> here, it seems...

It doesn't change the object's volatility; it only inhibits an
optimization. The optimizers don't work well in the presence of
volatile, and in this particular case, I don't believe it's worth
improving them.

> > As I said, it's the volatility of the *object* that is relevant.
> 
> I'm not sure what you mean here, the char is what I want to be
> volatile, and the cast seems to express that for me.

But it doesn't, as I've explained. Why didn't the example with "const"
convince you?


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