]> granicus.if.org Git - clang/commitdiff
Basic: The asm constraint '+#r' isn't valid, reject it
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 11 Jan 2015 08:52:38 +0000 (08:52 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 11 Jan 2015 08:52:38 +0000 (08:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225600 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/TargetInfo.cpp
test/Sema/asm.c

index aabb70dd6b1b77a05961e398e746369a03563605..3162b7cde239eb12fc2c8b0b602cf3cf939e60c4 100644 (file)
@@ -486,9 +486,13 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
       if (Name[1] == '=' || Name[1] == '+')
         Name++;
       break;
+    case '#': // Ignore as constraint.
+      while (Name[1] && Name[1] != ',')
+        Name++;
+      if (Name[1] != ',')
+        return false;
     case '?': // Disparage slightly code.
     case '!': // Disparage severely.
-    case '#': // Ignore as constraint.
     case '*': // Ignore for choosing register preferences.
       break;  // Pass them.
     }
index 2867acb1d36dd10a76df22300439b943448ddf1d..b4000cb5ff89c784b474c510e0ef545252ffeaf1 100644 (file)
@@ -177,3 +177,9 @@ void fn2() {
  __asm__(""
           : "+&m"(l)); // expected-error {{invalid output constraint '+&m' in asm}}
 }
+
+void fn3() {
+  int l;
+ __asm__(""
+          : "+#r"(l)); // expected-error {{invalid output constraint '+#r' in asm}}
+}