* gcc.dg/const-elim-1.c: xfail for xtensa.
[official-gcc.git] / gcc / testsuite / gcc.dg / sibcall-3.c
blob4806e15ee897e30d5c178f54b7f209ed01cacfa9
1 /* Simple check that sibling calls are performed from a
2 void non-leaf-function taking one int argument calling a function which
3 is about the same as itself.
5 Copyright (C) 2002 Free Software Foundation Inc.
6 Contributed by Hans-Peter Nilsson <hp@bitrange.com> */
8 /* { dg-do run { xfail arc-*-* avr-*-* c4x-*-* cris-*-* h8300-*-* ip2k-*-* m32r-*-* m68hc1?-*-* m681?-*-* m680*-*-* m68k-*-* mcore-*-* mips*-*-* mn10300-*-* ns32k-*-* s390*-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa-*-* } } */
9 /* { dg-options "-O2 -foptimize-sibling-calls" } */
11 /* The option -foptimize-sibling-calls is the default, but serves as
12 marker. This test is xfailed on targets without sibcall patterns
13 (except targets where the test does not work due to the return address
14 not saved on the regular stack). */
16 extern void recurser_void1 (int);
17 extern void recurser_void2 (int);
18 extern void track (int);
20 int main ()
22 recurser_void1 (0);
23 exit (0);
26 /* The functions should get the same stack-frame, and best way to make it
27 reasonably sure is to make them have the same contents (regarding the
28 n tests). */
30 void __attribute__((noinline))
31 recurser_void1 (int n)
33 if (n == 0 || n == 7 || n == 8)
34 track (n);
36 if (n == 10)
37 return;
39 recurser_void2 (n + 1);
42 void __attribute__((noinline))
43 recurser_void2 (int n)
45 if (n == 0 || n == 7 || n == 8)
46 track (n);
48 if (n == 10)
49 return;
51 recurser_void1 (n + 1);
54 void *trackpoint;
56 void
57 track (int n)
59 char stackpos[1];
61 if (n == 0)
62 trackpoint = stackpos;
63 else if ((n != 7 && n != 8) || trackpoint != stackpos)
64 abort ();