111
|
1 /* { dg-do compile } */
|
131
|
2 /* { dg-options "-O3 -fdump-ipa-cp-details -fno-ipa-sra" } */
|
111
|
3
|
|
4 typedef struct S
|
|
5 {
|
|
6 int (*call)(int);
|
|
7 } S;
|
|
8
|
|
9 static int __attribute__((noinline))
|
|
10 bar (const S *f, int x)
|
|
11 {
|
|
12 x = f->call(x);
|
|
13 return x;
|
|
14 }
|
|
15
|
|
16 extern void impossible_aa (void);
|
|
17
|
|
18 static int __attribute__((noinline))
|
|
19 baz (const S *f, int x)
|
|
20 {
|
|
21 impossible_aa ();
|
|
22 return bar (f, x);
|
|
23 }
|
|
24
|
|
25 static int
|
|
26 sq (int x)
|
|
27 {
|
|
28 return x * x;
|
|
29 }
|
|
30
|
|
31 static const S s = {sq};
|
|
32
|
|
33 int
|
|
34 g (int x)
|
|
35 {
|
|
36 return baz (&s, x);
|
|
37 }
|
|
38
|
|
39 int
|
|
40 obfuscate (int x)
|
|
41 {
|
|
42 return baz ((S *) 0, x);
|
|
43 }
|
|
44
|
|
45 /* { dg-final { scan-ipa-dump "Discovered an indirect call to a known target" "cp" } } */
|
|
46
|