[cfe-commits] r62666 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/Sema/asm.c
Anders Carlsson
andersca at mac.com
Tue Jan 20 22:27:20 PST 2009
Author: andersca
Date: Wed Jan 21 00:27:20 2009
New Revision: 62666
URL: http://llvm.org/viewvc/llvm-project?rev=62666&view=rev
Log:
Fix an inline asm sema bug that I introduced.
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/Sema/asm.c
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=62666&r1=62665&r2=62666&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Jan 21 00:27:20 2009
@@ -899,8 +899,8 @@
ParenExpr *InputExpr = cast<ParenExpr>(Exprs[i]);
// Only allow void types for memory constraints.
- if (info & TargetInfo::CI_AllowsMemory) {
-
+ if ((info & TargetInfo::CI_AllowsMemory)
+ && !(info & TargetInfo::CI_AllowsRegister)) {
if (InputExpr->isLvalue(Context) != Expr::LV_Valid)
return StmtError(Diag(InputExpr->getSubExpr()->getLocStart(),
diag::err_asm_invalid_lvalue_in_input)
Modified: cfe/trunk/test/Sema/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=62666&r1=62665&r2=62666&view=diff
==============================================================================
--- cfe/trunk/test/Sema/asm.c (original)
+++ cfe/trunk/test/Sema/asm.c Wed Jan 21 00:27:20 2009
@@ -46,5 +46,11 @@
asm ("nop" : : "r"(test4(addr))); // expected-error {{invalid type 'void' in asm input for constraint 'r'}}
asm ("nop" : : "m"(test4(addr))); // expected-error {{invalid lvalue in asm input for constraint 'm'}}
- asm("nop" : : "m"(f())); // expected-error {{invalid lvalue in asm input for constraint 'm'}}
+ asm ("nop" : : "m"(f())); // expected-error {{invalid lvalue in asm input for constraint 'm'}}
+}
+
+// <rdar://problem/6512595>
+void test5()
+{
+ asm("nop" : : "X" (8));
}
More information about the cfe-commits
mailing list