1 /* { dg-skip-if "requires frame pointers" { *-*-* } "-fomit-frame-pointer" "" } */
2 /* { dg-require-effective-target return_address } */
4 extern void exit (int);
5 extern void abort (void);
6 extern void *alloca (__SIZE_TYPE__
);
9 #define NOINLINE __attribute__((noinline)) __attribute__ ((noclone))
12 void *test4a (char *);
13 void *test5a (char *);
14 void *test6a (char *);
16 void NOINLINE
*test1 (void)
19 temp
= __builtin_return_address (0);
23 void NOINLINE
*test2 (void)
27 temp
= __builtin_return_address (0);
31 void NOINLINE
*test3 (void)
34 temp
= __builtin_return_address (0);
39 void NOINLINE
*test4 (void)
41 char * save
= (char*) alloca (4);
46 void *NOINLINE
test4a (char * p
)
49 temp
= __builtin_return_address (1);
53 void NOINLINE
*test5 (void)
55 char * save
= (char*) alloca (4);
60 void NOINLINE
*test5a (char * p
)
64 temp
= __builtin_return_address (1);
68 void NOINLINE
*test6 (void)
70 char * save
= (char*) alloca (4);
75 void NOINLINE
*test6a (char * p
)
78 temp
= __builtin_return_address (1);
83 void *(*func1
[6])(void) = { test1
, test2
, test3
, test4
, test5
, test6
};
85 char * NOINLINE
call_func1 (int i
)
87 save_ret1
[i
] = func1
[i
] ();
90 static void *ret_addr
;
92 void test10a (char *);
93 void test11a (char *);
94 void test12a (char *);
96 void NOINLINE
test7 (void)
98 ret_addr
= __builtin_return_address (0);
102 void NOINLINE
test8 (void)
105 ret_addr
= __builtin_return_address (0);
109 void NOINLINE
test9 (void)
111 ret_addr
= __builtin_return_address (0);
116 void NOINLINE
test10 (void)
118 char * save
= (char*) alloca (4);
123 void NOINLINE
test10a (char * p
)
125 ret_addr
= __builtin_return_address (1);
129 void NOINLINE
test11 (void)
131 char * save
= (char*) alloca (4);
136 void NOINLINE
test11a (char * p
)
139 ret_addr
= __builtin_return_address (1);
143 void NOINLINE
test12 (void)
145 char * save
= (char*) alloca (4);
150 void NOINLINE
test12a (char * p
)
152 ret_addr
= __builtin_return_address (1);
159 char * save
= (char*) alloca (4);
164 void (*func2
[6])(void) = { test7
, test8
, test9
, test10
, test11
, test12
};
166 void NOINLINE
call_func2 (int i
)
169 save_ret2
[i
] = ret_addr
;
176 for (i
= 0; i
< 6; i
++) {
180 if (save_ret1
[0] != save_ret1
[1]
181 || save_ret1
[1] != save_ret1
[2])
183 if (save_ret1
[3] != save_ret1
[4]
184 || save_ret1
[4] != save_ret1
[5])
186 if (save_ret1
[3] && save_ret1
[0] != save_ret1
[3])
190 for (i
= 0; i
< 6; i
++) {
194 if (save_ret2
[0] != save_ret2
[1]
195 || save_ret2
[1] != save_ret2
[2])
197 if (save_ret2
[3] != save_ret2
[4]
198 || save_ret2
[4] != save_ret2
[5])
200 if (save_ret2
[3] && save_ret2
[0] != save_ret2
[3])