PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-cstagg-1.c
blob4d64ea7d4cec5311dcb61454c322c367a277edde
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-ipa-cp-details" } */
4 typedef struct S
6 int add_offset;
7 int (*call)(int);
8 } S;
10 extern const S *gs;
12 static int __attribute__((noinline))
13 bar (const S *f, int x)
15 x = f->call(x);
16 x = f->call(x);
17 x = f->call(x);
18 gs = f;
19 return x;
22 static int
23 sq (int x)
25 return x * x;
28 static const S s = {16, sq};
30 int
31 g (int x)
33 return bar (&s, x);
36 int
37 obfuscate (int x)
39 return bar ((S *) 0, x);
42 /* { dg-final { scan-ipa-dump-times "Discovered an indirect call to a known target" 3 "cp" } } */