Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / nested-fn-1.c
blob99e852344a97f474bf9669ff42608bb8add44b89
1 /* PR middle-end/15345, c/16450 */
2 /* Test whether unused nested functions aren't emitted into the assembly. */
3 /* { dg-do compile } */
4 /* { dg-options "-g0" } */
5 /* { dg-require-effective-target trampolines } */
7 int
8 fn1 (int x)
10 int i = x;
11 inline __attribute__((always_inline)) int
12 should_not_appear1 (void)
14 return i;
16 return should_not_appear1 ();
19 int
20 fn2 (int x)
22 int i = x;
23 inline __attribute__((always_inline)) int
24 should_not_appear2 (void)
26 return i;
28 return x;
31 extern void check (void *p);
33 int
34 fn3 (int x)
36 int i = x;
37 inline int
38 should_appear1 (void)
40 char *p = __builtin_alloca (i);
41 check (p);
42 return i;
44 return should_appear1 ();
47 int
48 fn4 (int x)
50 int i = x;
51 inline int
52 should_not_appear3 (void)
54 char *p = __builtin_alloca (i);
55 check (p);
56 return i;
58 return 0 ? should_not_appear3 () : 1;
61 int
62 fn5 (int x)
64 int i = x;
65 inline int
66 should_appear2 (void)
68 return i;
70 check (should_appear2);
71 return i;
74 /* { dg-final { scan-assembler-not "should_not_appear" } } */