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

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Wed Oct 29 17:12:00 GMT 2003


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 bangerth at dealii dot org  2003-10-29 17:10 -------
> But it does change the object's volatility to change the assignment of "*sp =
> 0xE8" to "* (volatile char *) sp = 0xE8".

No, it doesn't. The type of a variable is a static quantity and not changed by
how you assign a value to it. You declared sp to be non-volatile, so it will
always be non-volatile.

> Gcc should at least be consistent
> here, it seems...

gcc is missing a chance to optimize. That's not a bug.

> I'm not sure what you mean here, the char is what I want to be volatile,

Then _declare_ it to be volatile!

W.



More information about the Gcc-bugs mailing list