This is the mail archive of the
mailing list for the GCC project.
Re: basic asm and memory clobbers - Proposed solution
- From: David Wohlferd <dw at LimeGreenSocks dot com>
- To: Paul_Koning at Dell dot com, bernd dot edlinger at hotmail dot de
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 29 Nov 2015 15:53:06 -0800
- Subject: Re: basic asm and memory clobbers - Proposed solution
- Authentication-results: sourceware.org; auth=none
- References: <56552209 dot 1020306 at LimeGreenSocks dot com> <56592801 dot 9010606 at LimeGreenSocks dot com> <HE1PR07MB09050E30BB6C251DBB454790E4020 at HE1PR07MB0905 dot eurprd07 dot prod dot outlook dot com> <9EAD225F-1323-439F-B697-C90F86F1D959 at dell dot com>
On 11/28/2015 10:30 AM, Paul_Koning@Dell.com wrote:
On Nov 28, 2015, at 2:02 AM, Bernd Edlinger <email@example.com> wrote:
Well, I start to think that Jeff is right, and we should treat a asm ("") as if it
were asm volatile ("" ::: ) but if the asm ("nonempty with optional %") we should
treat it as asm volatile ("nonempty with optional %%" ::: "memory").
I agree. Even if that goes beyond the letter of what the manual has promised before, it is the cautious answer, and it matches expectations of a lot of existing code.
Trying to guess what people might have been expecting is a losing game.
There is a way for people to be clear about what they want to clobber,
and that's to use extended asm. The way to clear up the ambiguity is to
start deprecating basic asm, not to add to the confusion by changing its
behavior after all these years.
And the first step to do that is to provide a means of finding them.
That's what the patch at
Once they are located, people can decide for themselves what to do. If
they favor the 'cautious' approach, they can change their asms to use
:::"memory" (or start clobbering registers too, to be *really* safe).
For people who require maximum backward compatibility and/or minimum
impact, they can use :::.
Have you tried that patch? How many warnings does it kick out for your