A number in an input constraint can't point to a read-write ('+') constraint. Fixes PR3904.

llvm-svn: 118145
This commit is contained in:
Anders Carlsson 2010-11-03 02:22:29 +00:00
parent e84eb99cbb
commit da1f5fc881
2 changed files with 10 additions and 0 deletions

View File

@ -350,6 +350,10 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
if (i >= NumOutputs)
return false;
// A number must refer to an output only operand.
if (OutputConstraints[i].isReadWrite())
return false;
// The constraint should have the same info as the respective
// output constraint.
Info.setTiedOperand(i, OutputConstraints[i]);

View File

@ -79,3 +79,9 @@ int test7(unsigned long long b) {
// <rdar://problem/7574870>
asm volatile (""); // expected-warning {{meaningless 'volatile' on asm outside function}}
// PR3904
int test8(int i) {
// A number in an input constraint can't point to a read-write constraint.
asm ("" : "+r" (i), "=r"(i) : "0" (i)); // expected-error{{invalid input constraint '0' in asm}}
}