[PATCH] D15075: No error for conflict between inputs\outputs and clobber list

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 13:05:52 PST 2016


ahatanak added a comment.

> After going a bit through the log, I think that there is no reason for clang to not detect it, probably the check was just forgotten.

> 

> This patch is the check.


Which part of your patch (in SemaStmtAsm.cpp) is supposed to catch that? I applied this patch and rebuilt clang, but it still doesn't error out when it compiles the function in my example (foo1).

> "r" constraint means (taken from the spec:) A register operand is allowed provided that it is in a general register.

>  ("%rcx") means - use the register rcx.


Isn't a) equivalent to b)?

a)
__asm__ __volatile__ ("asm1 %0, %1": "=a" (c) : "r" ("%ebx") : "cc", "ebx"); // do "b" and "%ebx" overlap?

b)
const char *s = "%ebx";
__asm__ __volatile__ ("asm1 %0, %1": "=a" (c) : "r" (s) : "cc", "ebx");

gcc and clang generate the same code for these two statements. I believe constraint "r" means clang can use any general purpose registers for the operand.


http://reviews.llvm.org/D15075





More information about the cfe-commits mailing list