| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
void* a(unsigned x) { |
| 4 |
return __builtin_return_address(0); |
| 5 |
} |
| 6 |
|
| 7 |
void b(unsigned x) { |
| 8 |
return __builtin_return_address(x); // expected-error{{argument to '__builtin_return_address' must be a constant integer}} |
| 9 |
} |
| 10 |
|
| 11 |
void* c(unsigned x) { |
| 12 |
// expected-error@+1 {{argument value 4294967295 is outside the valid range [0, 65535]}} |
| 13 |
return __builtin_return_address(-1); |
| 14 |
} |
| 15 |
|
| 16 |
void* d(unsigned x) { |
| 17 |
// expected-error@+1 {{argument value 1048575 is outside the valid range [0, 65535]}} |
| 18 |
return __builtin_return_address(0xFFFFF); |
| 19 |
} |
| 20 |
|
| 21 |
void* e(unsigned x) { |
| 22 |
return __builtin_frame_address(0); |
| 23 |
} |
| 24 |
|
| 25 |
void f(unsigned x) { |
| 26 |
// expected-error@+1 {{argument to '__builtin_frame_address' must be a constant integer}} |
| 27 |
return __builtin_frame_address(x); |
| 28 |
} |
| 29 |
|
| 30 |
void* g(unsigned x) { |
| 31 |
// expected-error@+1 {{argument value 4294967295 is outside the valid range [0, 65535]}} |
| 32 |
return __builtin_frame_address(-1); |
| 33 |
} |
| 34 |
|
| 35 |
void* h(unsigned x) { |
| 36 |
// expected-error@+1 {{argument value 1048575 is outside the valid range [0, 65535]}} |
| 37 |
return __builtin_frame_address(0xFFFFF); |
| 38 |
} |
| 39 |
|
| 40 |
void *i() { |
| 41 |
// expected-error@+1 {{too many arguments to function call, expected 0, have 1}} |
| 42 |
return __builtin_stack_address(0); |
| 43 |
} |