Skip to content
Snippets Groups Projects
Commit b6b5643b authored by David Majnemer's avatar David Majnemer
Browse files

Basic: Numeric constraints are multidigit

Clang would treat the digits in an "11m" input constraint separately as
if it was handling constraint 1 twice instead of constraint 11.

llvm-svn: 225606
parent 55164f90
No related branches found
No related tags found
No related merge requests found
......@@ -548,11 +548,17 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
default:
// Check if we have a matching constraint
if (*Name >= '0' && *Name <= '9') {
unsigned i = *Name - '0';
const char *DigitStart = Name;
while (Name[1] >= '0' && Name[1] <= '9')
Name++;
const char *DigitEnd = Name;
unsigned i;
if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
.getAsInteger(10, i))
return false;
// Check if matching constraint is out of bounds.
if (i >= NumOutputs)
return false;
if (i >= NumOutputs) return false;
// A number must refer to an output only operand.
if (OutputConstraints[i].isReadWrite())
......
......@@ -197,3 +197,10 @@ void fn5() {
: [g] "+r"(l)
: "[g]"(l)); // expected-error {{invalid input constraint '[g]' in asm}}
}
void fn6() {
int a;
__asm__(""
: "=rm"(a), "=rm"(a)
: "11m"(a)) // expected-error {{invalid input constraint '11m' in asm}}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment