Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Basic/Targets/X86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ bool X86TargetInfo::validateAsmConstraint(
}
case 'f': // Any x87 floating point stack register.
// Constraint 'f' cannot be used for output operands.
if (Info.ConstraintStr[0] == '=')
if (Info.ConstraintStr[0] == '=' || Info.ConstraintStr[0] == '+')
return false;
Info.setAllowsRegister();
return true;
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Sema/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ double f_output_constraint(void) {
return result;
}

double f_output_constraint_2(void) {
double result;
__asm("foo1": "+f" (result)); // expected-error {{invalid output constraint '+f' in asm}}
return result;
}

void fn1(void) {
int l;
__asm__(""
Expand Down
Loading