2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-cstagg-4.c
blob7458402c88e6592461a80f586a5725018db7509b
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-ipa-cp-details" } */
4 #define N 4
6 typedef int (* const A[N])(int);
8 typedef struct S
10 int add_offset;
11 A a;
12 } S;
14 extern const S *gs;
16 static int __attribute__((noinline))
17 bar (const S *f, int x)
19 gs = f;
20 x = f->a[2](x);
21 x = f->a[2](x);
22 x = f->a[2](x);
23 return x;
26 static int
27 zero (int x)
29 return 0;
32 static int
33 addone (int x)
35 return x + 1;
38 static int
39 sq (int x)
41 return x * x;
44 static int
45 cube (int x)
47 return x * x * x;
50 static const S s = {64, {zero, addone, sq, cube}};
52 int
53 g (int x)
55 return bar (&s, x);
58 int
59 obfuscate (int x)
61 return bar ((S *) 0, x);
64 /* { dg-final { scan-ipa-dump-times "Discovered an indirect call to a known target" 3 "cp" } } */