This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Dale Johannesen wrote:However, as a QOI issue, I believe the compiler should treat the reference as
volatile if either the object or the lvalue is volatile. That is obviously the
user's intent.
I'm not disagreeing with you, but I wonder at gcc's ability to make good on such a promise. A cast introducing a volatile qualifier will be a NOP_EXPR, and gcc tends to strip those at every opportunity.
Also, I wonder about the following example
int const avail = <something>
int main() { while (*(int *)&avail == Foo ()) do_something(); return 0; }
Seeing through the const-stripping cast is a useful optimization.
A further pathelogical case would be,
int main() { while (*(int *)(volatile int *)&avail) do_something (); return 0; }
What should this do, treat the volatile qualifier as sticky?
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |