Debian Codegraph @

gcc/testsuite/gcc.dg/ipa/ipcp-cstagg-3.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-ipa-cp-details" } */
3
4 #define N 4
5
6 typedef int (* const A[N])(int);
7
8 extern const A *ga;
9
10 static int __attribute__((noinline))
11 bar (const A *f, int x)
12 {
13 x = (*f)[2](x);
14 x = (*f)[2](x);
15 x = (*f)[2](x);
16 ga = f;
17 return x;
18 }
19
20 static int
21 zero (int x)
22 {
23 return 0;
24 }
25
26 static int
27 addone (int x)
28 {
29 return x + 1;
30 }
31
32 static int
33 sq (int x)
34 {
35 return x * x;
36 }
37
38 static int
39 cube (int x)
40 {
41 return x * x * x;
42 }
43
44 static const A a = {zero, addone, sq, cube};
45
46 int
47 g (int x)
48 {
49 return bar (&a, x);
50 }
51
52 int
53 obfuscate (int x)
54 {
55 return bar ((A *) 0, x);
56 }
57
58 /* { dg-final { scan-ipa-dump-times "Discovered an indirect call to a known target" 3 "cp" } } */