This is the mail archive of the 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: basic asm and memory clobbers - Proposed solution

On 11/28/2015 10:30 AM, wrote:
On Nov 28, 2015, at 2:02 AM, Bernd Edlinger <> 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 does.

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 projects?


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