summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Basic/TargetInfo.cpp8
-rw-r--r--clang/test/Sema/asm.c7
2 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 3162b7cde23..15b8c83d1b3 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -491,6 +491,7 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
Name++;
if (Name[1] != ',')
return false;
+ break;
case '?': // Disparage slightly code.
case '!': // Disparage severely.
case '*': // Ignore for choosing register preferences.
@@ -623,9 +624,14 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
break;
case ',': // multiple alternative constraint. Ignore comma.
break;
+ case '#': // Ignore as constraint.
+ while (Name[1] && Name[1] != ',')
+ Name++;
+ if (Name[1] != ',')
+ return false;
+ break;
case '?': // Disparage slightly code.
case '!': // Disparage severely.
- case '#': // Ignore as constraint.
case '*': // Ignore for choosing register preferences.
break; // Pass them.
}
diff --git a/clang/test/Sema/asm.c b/clang/test/Sema/asm.c
index b4000cb5ff8..10d845e3d0b 100644
--- a/clang/test/Sema/asm.c
+++ b/clang/test/Sema/asm.c
@@ -183,3 +183,10 @@ void fn3() {
__asm__(""
: "+#r"(l)); // expected-error {{invalid output constraint '+#r' in asm}}
}
+
+void fn4() {
+ int l;
+ __asm__(""
+ : "=r"(l)
+ : "#m"(l)); // expected-error {{invalid input constraint '#m' in asm}}
+}
OpenPOWER on IntegriCloud