basic asm and memory clobbers - Proposed solution
David Wohlferd <dw <at> LimeGreenSocks.com>
2015-11-25 02:50:49 GMT
I have solved the problem with my previous patch. Here's the update
(feedback welcome): http://www.LimeGreenSocks.com/gcc/24414g.zip
Based on my understanding from the previous thread, this patch now does
what it needs to do (code-wise) to resolve this "basic asm and memory
clobbers" issue. As mentioned previously, this patch introduces a new
warning (-Wonly-top-basic-asm), which is disabled by default. When
enabled, it triggers a warning for any basic asm inside a function,
unless the function has the "naked" attribute.
An argument can be made that the default for this warning should be
'enabled.' Yes, this will break builds that use basic asm and -Werror,
but it can easily be disabled with -Wno-only-top-basic-asm. And if we
don't enable it, no one is going to know the check is even available.
Then hidden problems like the one Paul was just describing still won't
be found, and optimizations will continue to have unexpected side
effects. OTOH, I can also see changing this to 'enabled' as more
appropriate in the next phase 1.
Now that I'm done with the code fix, I'm working on an update to the
docs. Obviously they should be checked in as part of the code fix. I'm
planning to actually use the word "deprecated" when describing the use
of basic asm within functions. Seems like a big step.
But there's no point in my proceeding any further until someone in
authority agrees that this is the desired solution. I'm not actually
sure who that is, but further work is a waste of time if no one is
prepared to approve it.
If you are that person, the questions to be answered are: