summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/nestfunc-5.c
blob: 88e74cc904cde80fa1f9795cdc3814f50f258488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
extern void abort (void);
extern void exit (int);

#ifndef NO_TRAMPOLINES
static void recursive (int n, void (*proc) (void))
{
  __label__ l1;

  void do_goto (void)
  {
    goto l1;
  }

  if (n == 3)
      recursive (n - 1, do_goto);
  else if (n > 0)
    recursive (n - 1, proc);
  else
    (*proc) ();
  return;

l1:
  if (n == 3)
    exit (0);
  else
    abort ();
}

int main ()
{
  recursive (10, abort);
  abort ();
}
#else
int main () { return 0; }
#endif