Author: majnemer
Date: Mon Dec 29 04:29:53 2014
New Revision: 224918

URL: http://llvm.org/viewvc/llvm-project?rev=224918&view=rev
Log:
Sema: Permit array l-values in asm output operands

GCC permits array l-values in asm output operands even though they
aren't modifiable l-values.  We used to permit it but this behavior
regressed in r224916.

Modified:
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp
    cfe/trunk/test/SemaCXX/statements.cpp

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=224918&r1=224917&r2=224918&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon Dec 29 04:29:53 2014
@@ -156,6 +156,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL
     case Expr::MLV_Valid:
       // Cool, this is an lvalue.
       break;
+    case Expr::MLV_ArrayType:
+      // This is OK too.
+      break;
     case Expr::MLV_LValueCast: {
       const Expr *LVal = OutputExpr->IgnoreParenNoopCasts(Context);
       if (!getLangOpts().HeinousExtensions) {

Modified: cfe/trunk/test/SemaCXX/statements.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/statements.cpp?rev=224918&r1=224917&r2=224918&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/statements.cpp (original)
+++ cfe/trunk/test/SemaCXX/statements.cpp Mon Dec 29 04:29:53 2014
@@ -30,3 +30,7 @@ void test4(int) {            // expected
   // expected-error@+1{{overloaded function could not be resolved}}
   __asm__ ("":"+r" (test4)); // expected-error{{invalid lvalue in asm output}}
 }
+void test5() {
+  char buf[1];
+  __asm__ ("":"+r" (buf));
+}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to