PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / pr41340.c
blob439046af89ed53d54af21fd28bb3f1ec76561e2b
1 /* PR debug/41340 */
2 /* { dg-do compile } */
3 /* { dg-options "-O3 -g -fcompare-debug" } */
4 /* { dg-options "-O3 -g -fcompare-debug -march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
5 /* { dg-skip-if "no long pointers" { { ! ilp32 } && { ! lp64 } } } */
7 typedef struct { int t; } *T;
8 struct S1 { unsigned s1; };
9 struct S2 { struct S1 s2; };
10 struct S3 { unsigned s3; struct S2 **s4; };
11 struct S5 { struct S2 *s5; };
13 __extension__ typedef __INTPTR_TYPE__ ssize_t;
15 extern void fn0 (void) __attribute__ ((__noreturn__));
16 T fn6 (struct S3);
17 void fn7 (void);
19 static inline __attribute__((always_inline)) int
20 fn1 (const struct S1 *x)
22 return x->s1;
25 static inline __attribute__((always_inline)) int
26 fn2 (const struct S1 *x, unsigned y)
28 if (y >= x->s1)
29 fn0 ();
30 return 0;
33 static inline __attribute__((always_inline)) int
34 fn3 (struct S3 x)
36 return (x.s3 == fn1 (*x.s4 ? &(*x.s4)->s2 : 0));
39 static inline __attribute__((always_inline)) int
40 fn4 (struct S3 x)
42 return fn2 (&(*x.s4)->s2, x.s3);
45 int
46 fn5 (struct S3 x, T *y)
48 if (!fn3 (x))
50 *y = (T) (ssize_t) fn4 (x);
51 return 1;
53 return 0;
56 void
57 test (struct S5 *x)
59 struct S3 a;
60 T b;
61 unsigned char c = 0;
62 a.s4 = &x->s5;
63 while (fn5 (a, &b))
64 if (!(b->t & 8))
65 c = 1;
66 a.s4 = &x->s5;
67 while ((b = fn6 (a)))
69 if (!c)
70 fn7 ();