basic asm and memory clobbers - Proposed solution

David Wohlferd dw@LimeGreenSocks.com
Tue Dec 1 22:28:00 GMT 2015


On 12/1/2015 10:10 AM, Bernd Edlinger wrote:
 > And a test case is missing too.
 >
 > I think this warning concentrates now only on basic asm.
 > And people will be probably fix it in the most easy way,
 > by just adding a colon.

Probably true.  At least I hope it's that easy for most people.

 > But IMHO asm("bla":) isn't any better than asm("bla").
 > I think _any_ asm with non-empty assembler string, that
 > claims to clobber _nothing_ is highly suspicious, and worth to be
 > warned about.  I don't see any exceptions from this rule.

There's one right now in the basic asm docs: asm("int $3");

And I've seen others: asm volatile ("nop"), asm(".byte 0xf1\n"). I've 
seen a bunch more, but you get the idea.

dw



More information about the Gcc mailing list