This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/17336] AVRGCC ignores "volatile" keyword for "register" variables
- From: "wilson at specifixinc dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Sep 2004 22:49:02 -0000
- Subject: [Bug c/17336] AVRGCC ignores "volatile" keyword for "register" variables
- References: <20040906135657.17336.m_klokov@mail.ru>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From wilson at specifixinc dot com 2004-09-06 22:49 -------
Subject: Re: New: AVRGCC ignores "volatile" keyword for "register"
variables
m_klokov at mail dot ru wrote:
> AVRGCC ignores "volatile" keyword for "register" variables
> when -o2 or -o3 optimization option is used.
You didn't say what was wrong with the code. Maybe you were expecting
all references to the volatile register to be atomic? They aren't.
That isn't what volatile means.
There is also a more general problem here in that gcc knows what a
volatile memory location is, but does not know what a volatile register
is. As a result, volatile register variables won't work the way you expect.
By the way, current gcc sources emit a warning for this testcase:
tmp.c:1: warning: volatile register variables don't work as you might wish
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17336