]> granicus.if.org Git - clang/commitdiff
Don't evaluate inout constraints twice. Fixes PR3800.
authorAnders Carlsson <andersca@mac.com>
Sun, 2 Aug 2009 03:40:19 +0000 (03:40 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 2 Aug 2009 03:40:19 +0000 (03:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77854 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 5b17b7b90084c57c3a8ad5f7d7f25d04292996da..2361c4a33424f76b0a814d901a2cde788c4fe7eb 100644 (file)
@@ -917,8 +917,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
       else
         InOutConstraints += OutputConstraint;
 
-      InOutArgTypes.push_back(Arg->getType());
-      InOutArgs.push_back(Arg);
+      InOutArgTypes.push_back(Dest.getAddress()->getType());
+      InOutArgs.push_back(Dest.getAddress());
     }
   }
   
diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c
new file mode 100644 (file)
index 0000000..e0e42a3
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t &&
+// RUN: grep "load i8\*\*\* %p.addr"  %t | count 1
+
+// PR3800
+void f(void **p)
+{
+    __asm__ volatile("" :"+m"(*p));
+}