]> granicus.if.org Git - clang/commitdiff
Handle readwrite constraints correctly
authorAnders Carlsson <andersca@mac.com>
Sun, 11 Jan 2009 19:46:50 +0000 (19:46 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 11 Jan 2009 19:46:50 +0000 (19:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62043 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
test/CodeGen/asm.c [new file with mode: 0644]

index 8d80a498b45ba87bb96b8bf87409c49b5575a7ba..bee40e5c28beed19aa796f38eed3d43bc05e0408 100644 (file)
@@ -944,9 +944,10 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
       const Expr *InputExpr = S.getOutputExpr(i);
       llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, InOutConstraints);
       
+      InOutConstraints += llvm::utostr(Args.size());
+
       InOutArgTypes.push_back(Arg->getType());
       InOutArgs.push_back(Arg);
-      InOutConstraints += OutputConstraint;
     }
   }
   
diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c
new file mode 100644 (file)
index 0000000..d6fbf77
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: clang %s -arch=i386 -verify -fsyntax-only
+void f(int len)
+{
+  __asm__ volatile("" :"=&r"(len), "+&r"(len));
+}