[cfe-commits] r97669 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGen/asm.c

Chris Lattner sabre at nondot.org
Wed Mar 3 13:52:23 PST 2010


Author: lattner
Date: Wed Mar  3 15:52:23 2010
New Revision: 97669

URL: http://llvm.org/viewvc/llvm-project?rev=97669&view=rev
Log:
fix PR6475, we were doing side-effecting stuff in an assert.

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/test/CodeGen/asm.c

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=97669&r1=97668&r2=97669&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Mar  3 15:52:23 2010
@@ -915,18 +915,17 @@
   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);
   }
 

Modified: cfe/trunk/test/CodeGen/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm.c?rev=97669&r1=97668&r2=97669&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/asm.c (original)
+++ cfe/trunk/test/CodeGen/asm.c Wed Mar  3 15:52:23 2010
@@ -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 @@
        );
   return 0;
 }
+
+// PR6475
+void t17() {
+  int i;
+  __asm__ ( "nop": "=m"(i));
+  
+// CHECK: @t17()
+// CHECK: call void asm "nop", "=*m,
+}
+





More information about the cfe-commits mailing list