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-*-* } && ilp32 } } } */ 5/* { dg-skip-if "no long pointers" { { ! ilp32 } && { ! lp64 } } } */ 6 7typedef struct { int t; } *T; 8struct S1 { unsigned s1; }; 9struct S2 { struct S1 s2; }; 10struct S3 { unsigned s3; struct S2 **s4; }; 11struct S5 { struct S2 *s5; }; 12 13__extension__ typedef __INTPTR_TYPE__ ssize_t; 14 15extern void fn0 (void) __attribute__ ((__noreturn__)); 16T fn6 (struct S3); 17void fn7 (void); 18 19static inline __attribute__((always_inline)) int 20fn1 (const struct S1 *x) 21{ 22 return x->s1; 23} 24 25static inline __attribute__((always_inline)) int 26fn2 (const struct S1 *x, unsigned y) 27{ 28 if (y >= x->s1) 29 fn0 (); 30 return 0; 31} 32 33static inline __attribute__((always_inline)) int 34fn3 (struct S3 x) 35{ 36 return (x.s3 == fn1 (*x.s4 ? &(*x.s4)->s2 : 0)); 37} 38 39static inline __attribute__((always_inline)) int 40fn4 (struct S3 x) 41{ 42 return fn2 (&(*x.s4)->s2, x.s3); 43} 44 45int 46fn5 (struct S3 x, T *y) 47{ 48 if (!fn3 (x)) 49 { 50 *y = (T) (ssize_t) fn4 (x); 51 return 1; 52 } 53 return 0; 54} 55 56void 57test (struct S5 *x) 58{ 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))) 68 ; 69 if (!c) 70 fn7 (); 71} 72