This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: volatile semantics
Richard Henderson <rth@redhat.com> writes:
| On Sun, Jul 17, 2005 at 05:03:55PM +0100, Nathan Sidwell wrote:
| > Issue 1.
| > void Foo (char *ptr) {
| > *(volatile char *)ptr;
| > }
| ...
| > char c;
| > *(volatile char *)&c; // can this read be deleted?
| ...
| > void Foo (volatile char *ptr) {
| > *(char *)ptr;
|
| I did see Ian's summary,
|
| http://gcc.gnu.org/ml/gcc/2005-07/msg00714.html
|
| wherein he ascribed the semantics of the volatile qualifier to the
| access, and not to the object. I agree with his description completely,
| as I believe it embodies the intuition that C programmers have used
| wrt these qualifiers since forever.
Great!
even you explained yourself in a previous message, I think it would
have saved lots if you spoke earlier ;-p
| So the answers to the "deleteable" questions above are no, no, yes.
|
| And it's probably a one-line bug in our "can this cast be removed"
| function.
Daniel Berlin posted an almost one-liner patch.
-- Gaby