From: David Majnemer Date: Sun, 11 Jan 2015 08:52:38 +0000 (+0000) Subject: Basic: The asm constraint '+#r' isn't valid, reject it X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afd75deb8f2b45ab5e37935646782185ed05fac4;p=clang Basic: The asm constraint '+#r' isn't valid, reject it git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225600 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index aabb70dd6b..3162b7cde2 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -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. } diff --git a/test/Sema/asm.c b/test/Sema/asm.c index 2867acb1d3..b4000cb5ff 100644 --- a/test/Sema/asm.c +++ b/test/Sema/asm.c @@ -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}} +}