------- Additional Comments From gcc2eran at tromer dot org 2005-07-03 05:09 ------- (In reply to comment #32) > | I meant that we were mostly concerned about what the standard says about the > | effect of casting (say) int* into volatile int*, but the other directly is > | simply undefined. > > That is what I do not understand. Could you point me to the relevant > passage of the C standard?
(my quote above should read "the other *direction* is simply undefined") Uhm? It's just the passage you quoted earlier: "If an attempt is made to refer to an object defined with a volatile-qualified type through use of an lvalue with non-volatile-qualified type, the behavior is undefined". > > | void quux(int *bar) { > | *(volatile int*)bar = 42; > | } > | > | volatile int foo; > | quux((int*)&foo); > | > | This time there is no "attempt [...] to refer to an object defined with a > | volatile-qualified type through use of an lvalue with non-volatile-qualified > | type". > > Really? What does quux() does to the object defined through foo then? It refers to it through an lvalue whose type is "volatile int", which *is* volatile-qualified. > My understanding is that you have gotten everything backwards. In what sense? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22278