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]

Re: volatile semantics


object volatile).

I don't understand your point. given void Foo (char const * a) { *(char *)a = 5; } the compiler generates code to store 5 through the pointer 'a'. It doesn't turn this into a call to 'abort', because it thinks you're writing to const storage.

Is this *always* the cast, or just in the example above?



So, here it appears the compiler does believe the (char *) cast.

I imagine this is due to some workaround in an optimizer for some bug it exposed elswhere.


 Why should it
not believe a (char volatile *) cast -- unless it can determine the static type
of the object pointed to?

It appears he was saying that *even if it could determine the static type*, the volatile qualifier on the cast *made the object not that type anymore*. And i'm not sure why such a thing would apply only to volatile, if true.



--Dan



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]