Skip to content
Snippets Groups Projects
Commit 5ddf70f1 authored by Benjamin Kramer's avatar Benjamin Kramer
Browse files

Reject asm output constraints that consist of modifiers only.

Fixes PR15759.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179756 91177308-0d34-0410-b5e6-96231b3b80d8
parent 0579c165
No related branches found
No related tags found
No related merge requests found
...@@ -373,7 +373,7 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const { ...@@ -373,7 +373,7 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
Name++; Name++;
} }
return true; return Info.allowsMemory() || Info.allowsRegister();
} }
bool TargetInfo::resolveSymbolicName(const char *&Name, bool TargetInfo::resolveSymbolicName(const char *&Name,
......
...@@ -130,3 +130,19 @@ void test14(struct S *s) { ...@@ -130,3 +130,19 @@ void test14(struct S *s) {
__asm("": : "a"(*s)); // expected-error {{dereference of pointer to incomplete type 'struct S'}} __asm("": : "a"(*s)); // expected-error {{dereference of pointer to incomplete type 'struct S'}}
__asm("": "=a" (*s) :); // expected-error {{dereference of pointer to incomplete type 'struct S'}} __asm("": "=a" (*s) :); // expected-error {{dereference of pointer to incomplete type 'struct S'}}
} }
// PR15759.
double test15() {
double ret = 0;
__asm("0.0":"="(ret)); // expected-error {{invalid output constraint '=' in asm}}
__asm("0.0":"=&"(ret)); // expected-error {{invalid output constraint '=&' in asm}}
__asm("0.0":"+?"(ret)); // expected-error {{invalid output constraint '+?' in asm}}
__asm("0.0":"+!"(ret)); // expected-error {{invalid output constraint '+!' in asm}}
__asm("0.0":"+#"(ret)); // expected-error {{invalid output constraint '+#' in asm}}
__asm("0.0":"+*"(ret)); // expected-error {{invalid output constraint '+*' in asm}}
__asm("0.0":"=%"(ret)); // expected-error {{invalid output constraint '=%' in asm}}
__asm("0.0":"=,="(ret)); // expected-error {{invalid output constraint '=,=' in asm}}
__asm("0.0":"=,g"(ret)); // no-error
__asm("0.0":"=g"(ret)); // no-error
return ret;
}
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