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