xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/builtin-stackaddress.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
a(unsigned x)2*f4a2713aSLionel Sambuc void* a(unsigned x) {
3*f4a2713aSLionel Sambuc return __builtin_return_address(0);
4*f4a2713aSLionel Sambuc }
5*f4a2713aSLionel Sambuc 
b(unsigned x)6*f4a2713aSLionel Sambuc void b(unsigned x) {
7*f4a2713aSLionel Sambuc return __builtin_return_address(x); // expected-error{{argument to '__builtin_return_address' must be a constant integer}}
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc 
c(unsigned x)10*f4a2713aSLionel Sambuc void* c(unsigned x) {
11*f4a2713aSLionel Sambuc return __builtin_frame_address(0);
12*f4a2713aSLionel Sambuc }
13*f4a2713aSLionel Sambuc 
d(unsigned x)14*f4a2713aSLionel Sambuc void d(unsigned x) {
15*f4a2713aSLionel Sambuc return __builtin_frame_address(x); // expected-error{{argument to '__builtin_frame_address' must be a constant integer}}
16*f4a2713aSLionel Sambuc }
17