]> granicus.if.org Git - clang/commitdiff
fix PR6475, we were doing side-effecting stuff in an assert.
authorChris Lattner <sabre@nondot.org>
Wed, 3 Mar 2010 21:52:23 +0000 (21:52 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 3 Mar 2010 21:52:23 +0000 (21:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97669 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
test/CodeGen/asm.c

index 008a480b9c121af0fccb6cb76f9639f5988b9a87..a889e55a9e8031c70412ff09444d80c96eba3f56 100644 (file)
@@ -915,18 +915,17 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
   for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) {
     TargetInfo::ConstraintInfo Info(S.getOutputConstraint(i),
                                     S.getOutputName(i));
-    assert(Target.validateOutputConstraint(Info) && 
-           "Failed to parse output constraint");
+    bool IsValid = Target.validateOutputConstraint(Info); (void)IsValid;
+    assert(IsValid && "Failed to parse output constraint"); 
     OutputConstraintInfos.push_back(Info);
   }
 
   for (unsigned i = 0, e = S.getNumInputs(); i != e; i++) {
     TargetInfo::ConstraintInfo Info(S.getInputConstraint(i),
                                     S.getInputName(i));
-    assert(Target.validateInputConstraint(OutputConstraintInfos.data(),
-                                          S.getNumOutputs(),
-                                          Info) &&
-           "Failed to parse input constraint");
+    bool IsValid = Target.validateInputConstraint(OutputConstraintInfos.data(),
+                                                  S.getNumOutputs(), Info);
+    assert(IsValid && "Failed to parse input constraint"); (void)IsValid;
     InputConstraintInfos.push_back(Info);
   }
 
index df593d79fa17ceb84c1289e4bf959720dcfc89b6..fe9ca9a4c748cda6fdec05bebc68b4c4e7712493 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
 void t1(int len) {
   __asm__ volatile("" : "=&r"(len), "+&r"(len));
 }
@@ -110,3 +110,13 @@ int t16() {
        );
   return 0;
 }
+
+// PR6475
+void t17() {
+  int i;
+  __asm__ ( "nop": "=m"(i));
+  
+// CHECK: @t17()
+// CHECK: call void asm "nop", "=*m,
+}
+