2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / pr63416.c
blobb5374c51fe9293fd38ca3c7ab836c81b5d890ece
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
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" } } */