PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-cstagg-7.c
blobb08c420cd86b039faf2c10aa40e2f46d37034c2f
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, *hs;
16 static int __attribute__((noinline))
17 foo (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 __attribute__((noinline))
27 bar (const S f, int x)
29 hs = &f;
30 return foo (f, x);
33 static int
34 zero (int x)
36 return 0;
39 static int
40 addone (int x)
42 return x + 1;
45 static int
46 sq (int x)
48 return x * x;
51 static int
52 cube (int x)
54 return x * x * x;
57 static const S s = {64, {zero, addone, sq, cube}};
59 int
60 h (int x)
62 return bar (s, x);
65 /* { dg-final { scan-ipa-dump-times "Discovered an indirect call to a known target" 3 "cp" { xfail { hppa*-*-* && { ! lp64 } } } } } */