PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / pr66444.c
blob3f92a5c779b84666ec673b56dd078dd10b78c2b9
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fipa-ra" } */
4 extern void abort (void);
6 #if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
7 #define ADD_SUFFIX(a) a ## ULL
8 #elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
9 #define ADD_SUFFIX(a) a ## UL
10 #elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
11 #define ADD_SUFFIX(a) a ## U
12 #else
13 #error Add target support here
14 #endif
16 #if __SIZEOF_POINTER__ <= 4
17 /* Use a 16 bit pointer to have a valid pointer for 16-bit to 31-bit pointer
18 architectures. Using sizeof, we cannot distinguish between 31-bit and 32-bit
19 pointer types, so we also handle the 32-bit pointer type case here. */
20 #define CONST_PTR ADD_SUFFIX (0x800)
21 #else
22 /* For x86_64 -m64, the problem reproduces with this 32-bit CONST_PTR, but not
23 with a 2-power below it. */
24 #define CONST_PTR ADD_SUFFIX (0x80000000)
25 #endif
27 int __attribute__((noinline, noclone))
28 bar (void)
30 return 1;
33 struct S
35 unsigned long p, q, r;
36 void *v;
39 struct S *s1;
40 struct S *s2;
42 void __attribute__((noinline, noclone))
43 fn2 (struct S *x)
45 s2 = x;
48 __attribute__((noinline, noclone)) void *
49 fn1 (struct S *x)
51 /* Just a statement to make it a non-const function. */
52 s1 = x;
54 return (void *)0;
57 int __attribute__((noinline, noclone))
58 baz (void)
60 struct S *x = (struct S *) CONST_PTR;
62 x += bar ();
64 fn1 (x);
65 fn2 (x);
67 return 0;
70 int
71 main (void)
73 baz ();
75 if (s2 != (((struct S *) CONST_PTR) + 1))
76 abort ();
78 return 0;