2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / sibcall-7.c
blob6d59ca3395fe7d3c0f647cd9718e5a04efe70a81
1 /* Simple check that tail recursive call optimization is also
2 controlled by -foptimize-sibling-calls.
4 Copyright (C) 2006 Free Software Foundation Inc.
5 Original test by Hans-Peter Nilsson <hp@bitrange.com> */
7 /* On IA64 the call frame is allocated on the register stack, not the
8 normal stack. */
10 /* { dg-do run { target { ! "ia64-*-*" } } } */
11 /* { dg-options "-O2 -fno-optimize-sibling-calls" } */
14 extern void abort (void);
16 extern void recurser_void (int);
17 extern void track (int);
19 int main (void)
21 recurser_void (0);
22 return 0;
25 void recurser_void (int n)
27 if (n == 0 || n == 7)
28 track (n);
30 if (n == 10)
31 return;
33 recurser_void (n + 1);
36 void *trackpoint;
38 void track (int n)
40 char stackpos[1];
42 if (n == 0)
43 trackpoint = stackpos;
44 else if (n != 7 || trackpoint == stackpos)
45 abort ();