2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / nested-func-8.c
blobccec27d08fbdcfd20cc6d7fa39a8e1a962b1359c
1 /* { dg-do run } */
2 /* { dg-options "-O -fno-inline" } */
4 extern void abort (void);
6 /* Return 0 and clobber the static chain. */
8 int
9 zero (int n)
11 int
12 nested (int m)
14 return m - n;
17 return nested (n);
20 /* Return the triple of ARG in a convoluted manner. */
22 int
23 triple (int arg)
25 int
26 read_arg (void)
28 return arg;
31 int
32 parent (int nested_arg)
34 int
35 child1 (void)
37 return parent (zero (5));
40 int
41 child2 (void)
43 return nested_arg + read_arg ();
46 return (nested_arg == 0 ? 0 : child1 ()) + child2 ();
49 return parent (arg);
52 int main(void)
54 if (triple (13) != 3 * 13)
55 abort ();
56 return 0;