[PATCH] Adding option -fno-inline-asm to disallow inline asm

Bob Wilson bob.wilson at apple.com
Fri Jan 16 11:12:02 PST 2015

In http://reviews.llvm.org/D6870#109832, @rnk wrote:

> In http://reviews.llvm.org/D6870#109616, @steven_wu wrote:
> > - Update patch that AsmLabels are now disabled with -fno-gnu-inline-asm. This also means functions with asm-labels will also be reported as an error with -fno-gnu-inline-asm.
> I wasn't suggesting that we reject function asm labels, I was suggesting that we reject variables marked as living in specific registers. Consider something like:
>   register void *sp asm("esp");
>   int main () {
>     printf("sp: %p\n", sp);
>   }
> This code compiles down to read the esp register in main.
> I think using asm labels to rename something is not inherently architecture specific and could be accepted even in the presence of -fno-inline-asm. What do you think?

I agree that function asm labels are a separate thing and should not be affected by -fno-gnu-inline-asm. It would still be good to disallow register asm with that flag, though.

I like the suggestion to call this option "-fno-gnu-inline-asm", but if we do that, I don't see a need to keep "-fno-inline-asm". If someone really wants to prevent both GNU and Microsoft-style inline asm, they can just specify -fno-gnu-inline-asm and -fno-asm-blocks.



More information about the cfe-commits mailing list