2008-03-21 Janne Blomqvist <jb@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-return-1.c
blob75c9acdf72a581ba88c155c1238a1d2bd99b7509
1 /* PR middle-end/11151 */
2 /* Originator: Andrew Church <gcczilla@achurch.org> */
3 /* { dg-do run } */
5 /* This used to fail on SPARC because the (undefined) return
6 value of 'bar' was overwriting that of 'foo'. */
8 extern void abort(void);
10 int foo(int n)
12 return n+1;
15 int bar(int n)
17 __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64));
20 char *g;
22 int main(void)
24 /* Allocate 64 bytes on the stack to make sure that __builtin_apply
25 can read at least 64 bytes above the return address. */
26 char dummy[64];
28 g = dummy;
30 if (bar(1) != 2)
31 abort();
33 return 0;