implement PR4077: [Linux kernel] inscrutable error on inline asm input/output constraint mismatch
Before we emitted:
$ clang t.c -S -m64
llvm: error: Unsupported asm: input constraint with a matching output constraint of incompatible type!
Now we produce:
$ clang t.c -S -m64
t.c:5:40: error: unsupported inline asm: input with type 'unsigned long' matching output with type 'int'
asm volatile("foo " : "=a" (a) :"0" (b));
~~~ ~^~
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70142 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/asm.c b/test/Sema/asm.c
index 4072a5c..602b773 100644
--- a/test/Sema/asm.c
+++ b/test/Sema/asm.c
@@ -69,3 +69,10 @@
asm("%9" :: "i"(4)); // expected-error {{invalid operand number in inline asm string}}
asm("%1" : "+r"(i)); // ok, referring to input.
}
+
+// PR4077
+int test7(unsigned long long b) {
+ int a;
+ asm volatile("foo " : "=a" (a) :"0" (b)); // expected-error {{input with type 'unsigned long long' matching output with type 'int'}}
+ return a;
+}