This is the mail archive of the gcc-bugs@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]

[Bug c/22278] gcc -O2 discards cast to volatile


------- Additional Comments From gdr at integrable-solutions dot net  2005-07-03 05:11 -------
Subject: Re:  gcc -O2 discards cast to volatile

"gdr at integrable-solutions dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| | 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?

that comment is wrong, sorry.  You're right.  (time for me to go to bed).
Yes, this is a bug in GCC.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22278


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