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

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Wed Oct 29 16:16: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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From bangerth at dealii dot org  2003-10-29 16:16 -------
I agree with Falk. Of course, volatile char * is a pointer to 
a volatile char, but you are accessing a non-volatile object
through a pointer to a volatile char. That doesn't change the
non-volatility of the object and gcc should be free to optimize
away the access. If you want to retain the read in the loop,
declare the object as volatile.

W.



More information about the Gcc-bugs mailing list