This is the mail archive of the gcc-patches@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: [PATCH] volatile global register variable


David Edelsohn wrote:
>>>>>>Daniel Jacobowitz writes:
> 
> 
> Dan> Could you explain what these times are, for the curious?
> 
> 	The issue is how much one expects GCC to try to optimize code
> using global register variables and how much one wants GCC to try to
> prevent it.  At some level this is going to become a DWIM scenario if GCC
> does not allow the programmer to inform the compiler where it is and is
> not safe using attributes like volatile.

I think David's patch (with documentation, as Joseph suggested) is a
good idea.  We want to move towards finer control of warnings, and,
apparently, this one is annoying some kernel developers.  So, the patch
is OK, once the documentation is added.

However, I'd also like to see the warning message improved.  I don't
think it's necessary (the patch is still an improvement without changing
the message), but something like:

warning: optimization may eliminate reads and/or writes to global
register variables

would seem a lot more helpful that "don't work as you might wish" which
is cryptic in the extreme.

I'm not sure how to solve the broader problems that David and Ian have
raised.  David points out that being sure never to optimize volatile
register variables may be hard; Ian points out that we already have to
do that for volatile memory, so maybe it's not too hard.  I don't know
how hard it might be, but it does seem like abstractly the right thing;
the rules for a volatile register variable ought to be the same as the
rules for any other volatile object.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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