Debian Codegraph @

gcc/testsuite/g++.dg/lto/alias-2_0.C

raw
1 /* { dg-lto-do run } */
2 /* { dg-lto-options { { -O3 -flto } } } */
3
4 /* With LTO we consider all pointers to incomplete types to be possibly
5 aliasing. This makes *bptr to alias with aptr.
6 For C++ ODR types we however can work out that they are actually
7 different. */
8
9 #include <string.h>
10
11 typedef int (*fnptr) ();
12
13 __attribute__ ((used))
14 struct a *aptr;
15
16 __attribute__ ((used))
17 struct b **bptr = (struct b**)&aptr;
18 extern void init ();
19 extern void inline_me_late (int);
20 int n=1;
21
22
23 int
24 main (int argc, char **argv)
25 {
26 init ();
27 aptr = 0;
28 for (int i=0; i<n; i++)
29 inline_me_late (argc);
30 if (!__builtin_constant_p (aptr == 0))
31 __builtin_abort ();
32 return (size_t)aptr;
33 }