[cfe-commits] r118145 - in /cfe/trunk: lib/Basic/TargetInfo.cpp test/Sema/asm.c

Anders Carlsson andersca at mac.com
Tue Nov 2 19:22:29 PDT 2010


Author: andersca
Date: Tue Nov  2 21:22:29 2010
New Revision: 118145

URL: http://llvm.org/viewvc/llvm-project?rev=118145&view=rev
Log:
A number in an input constraint can't point to a read-write ('+') constraint. Fixes PR3904.

Modified:
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/test/Sema/asm.c

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=118145&r1=118144&r2=118145&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Nov  2 21:22:29 2010
@@ -350,6 +350,10 @@
         if (i >= NumOutputs)
           return false;
 
+        // A number must refer to an output only operand.
+        if (OutputConstraints[i].isReadWrite())
+          return false;
+
         // The constraint should have the same info as the respective
         // output constraint.
         Info.setTiedOperand(i, OutputConstraints[i]);

Modified: cfe/trunk/test/Sema/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=118145&r1=118144&r2=118145&view=diff
==============================================================================
--- cfe/trunk/test/Sema/asm.c (original)
+++ cfe/trunk/test/Sema/asm.c Tue Nov  2 21:22:29 2010
@@ -79,3 +79,9 @@
 
 // <rdar://problem/7574870>
 asm volatile (""); // expected-warning {{meaningless 'volatile' on asm outside function}}
+
+// PR3904
+int test8(int i) {
+  // A number in an input constraint can't point to a read-write constraint.
+  asm ("" : "+r" (i), "=r"(i) :  "0" (i)); // expected-error{{invalid input constraint '0' in asm}}
+}





More information about the cfe-commits mailing list