This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] volatile global register variable
>>>>> Mark Mitchell writes:
Mark> I'm not sure how to solve the broader problems that David and Ian have
Mark> raised. David points out that being sure never to optimize volatile
Mark> register variables may be hard; Ian points out that we already have to
Mark> do that for volatile memory, so maybe it's not too hard. I don't know
Mark> how hard it might be, but it does seem like abstractly the right thing;
Mark> the rules for a volatile register variable ought to be the same as the
Mark> rules for any other volatile object.
My concern is not about volatile, but about global register
variables having overloaded and ambiguous semantics. I specifically think
we should avoid global register variables implying volatile. Some
constituency will not be happy -- either wanting more aggressive
optimization or being unhappy about an optimization transformation. If a
programmer really wants a volatile global register variable, he or she
should use the volatile modifier.
We can ensure that volatile is used consistently throughout the
compiler. I want to avoid GCC testing "volatile or global register"
because someone is going to forget to add the latter and introduce a
latent bug. That likely will lead to long arguments about what the
semantics should be. I want to stop that thread before it starts.
David