Debian Codegraph @

gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-2.c

raw
1 /* PR target/93047 */
2 /* Originator: Andrew Church <[email protected]> */
3 /* { dg-do run } */
4 /* { dg-additional-options "-O3 -frename-registers" } */
5 /* { dg-require-effective-target untyped_assembly } */
6
7 #ifdef __MMIX__
8 /* No parameters on stack for bar. */
9 #define STACK_ARGUMENTS_SIZE 0
10 #else
11 #define STACK_ARGUMENTS_SIZE 64
12 #endif
13
14 extern void abort(void);
15
16 int foo(int n)
17 {
18 return n+1;
19 }
20
21 int bar(int n)
22 {
23 __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(),
24 STACK_ARGUMENTS_SIZE));
25 }
26
27 int main(void)
28 {
29 /* Allocate 64 bytes on the stack to make sure that __builtin_apply
30 can read at least 64 bytes above the return address. */
31 char dummy[64];
32
33 __asm__ ("" : : "" (dummy));
34
35 if (bar(1) != 2)
36 abort();
37
38 return 0;
39 }
40