libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / pr63416.c
blobc7bc97e0bb1ba211d2e908022ee73191556202d1
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized --param early-inlining-insns=14" } */
3 #define _UNUSED_ __attribute__((__unused__))
5 typedef int TEST_F30 (int *v);
6 typedef void TEST_F31 (int *v);
7 typedef void TEST_F32 (int *v, int r);
9 typedef struct TEST_T30_ {
10 TEST_F30 * pf30;
11 TEST_F31 * pf31;
12 TEST_F32 * pf32;
13 } TEST_T30;
15 static inline
16 int test_f30 (int *v)
18 *v = 1;
19 return 0;
20 }//test_f30()
22 static inline
23 void test_f31 (int *v _UNUSED_)
25 }//test_f31()
27 static inline
28 void test_f32 (int *v, int r _UNUSED_)
30 *v = 0;
31 }//test_f32()
33 static const
34 TEST_T30 test_t30 = {
35 .pf30 = test_f30,
36 .pf31 = test_f31,
37 .pf32 = test_f32,
40 static inline
41 int test_f10 (const TEST_T30 *pt30, int *v)
43 int r = pt30->pf30(v);
44 pt30->pf31(v);
45 pt30->pf32(v, r);
46 return 0;
47 }//test_f10()
49 int test_f00 (int *v)
51 return test_f10(&test_t30, v);
52 }//test_f00()
54 /* Everything should be inlined and only test_f00 body should appear. */
55 /* { dg-final { scan-tree-dump-not "test_f10" "optimized" } } */
56 /* { dg-final { scan-tree-dump-not "test_f3" "optimized" } } */