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