OSDN Git Service

* gcc.dg/torture/builtin-modf-1.c: Remove -funsafe-math-optimizations.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / nested-fn-1.c
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
6 int
7 fn1 (int x)
8 {
9   int i = x;
10   inline __attribute__((always_inline)) int
11   should_not_appear1 (void)
12   {
13     return i;
14   }
15   return should_not_appear1 ();
16 }
17
18 int
19 fn2 (int x)
20 {
21   int i = x;
22   inline __attribute__((always_inline)) int
23   should_not_appear2 (void)
24   {
25     return i;
26   }
27   return x;
28 }
29
30 extern void check (void *p);
31
32 int
33 fn3 (int x)
34 {
35   int i = x;
36   inline int
37   should_appear1 (void)
38   {
39     char *p = __builtin_alloca (i);
40     check (p);
41     return i;
42   }
43   return should_appear1 ();
44 }
45
46 int
47 fn4 (int x)
48 {
49   int i = x;
50   inline int
51   should_not_appear3 (void)
52   {
53     char *p = __builtin_alloca (i);
54     check (p);
55     return i;
56   }
57   return 0 ? should_not_appear3 () : 1;
58 }
59
60 int
61 fn5 (int x)
62 {
63   int i = x;
64   inline int
65   should_appear2 (void)
66   {
67     return i;
68   }
69   check (should_appear2);
70   return i;
71 }
72
73 /* { dg-final { scan-assembler-not "should_not_appear" } } */