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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to