"gcc2eran at tromer dot org" <[EMAIL PROTECTED]> writes: | (In reply to comment #30) | > | OK. Then the volatile-stripping direction can be handled arbitrarily. | > | > I do not understand that comment. | | 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? | Still, consider the following variant: | | 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? | So why does gcc 4.0.0 -O3 still optimize away the assignment? And how | would you fix that with an approach that construes the standard to require | following the type of the "real" object? | | Could the standard intend something so convoluted, when the interpretation in | comment 23 makes things perfectly sensible, well-defined and (in principle) easy | to implement? My understanding is that you have gotten everything backwards. -- Gaby