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 } } } */
       6  
       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; };
      12  
      13  __extension__ typedef __INTPTR_TYPE__ ssize_t;
      14  
      15  extern void fn0 (void) __attribute__ ((__noreturn__));
      16  T fn6 (struct S3);
      17  void fn7 (void);
      18  
      19  static inline __attribute__((always_inline)) int
      20  fn1 (const struct S1 *x)
      21  {
      22    return x->s1;
      23  }
      24  
      25  static inline __attribute__((always_inline)) int
      26  fn2 (const struct S1 *x, unsigned y)
      27  {
      28    if (y >= x->s1)
      29      fn0 ();
      30    return 0;
      31  }
      32  
      33  static inline __attribute__((always_inline)) int
      34  fn3 (struct S3 x)
      35  {
      36    return (x.s3 == fn1 (*x.s4 ? &(*x.s4)->s2 : 0));
      37  }
      38  
      39  static inline __attribute__((always_inline)) int
      40  fn4 (struct S3 x)
      41  {
      42    return fn2 (&(*x.s4)->s2, x.s3);
      43  }
      44  
      45  int
      46  fn5 (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  
      56  void
      57  test (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  }