forked from OSchip/llvm-project
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
This commit is contained in:
parent
55164f901b
commit
b6b5643b36
|
@ -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}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue