(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
20030826-2.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -fomit-frame-pointer" } */
       3  /* { dg-options "-O2 -fomit-frame-pointer -march=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
       4  
       5  extern void abort (void);
       6  extern void exit (int);
       7  
       8  struct S
       9  {
      10    int *a;
      11    unsigned char *b, c;
      12  };
      13  
      14  int u, v, w;
      15  
      16  void
      17  foo (unsigned short x)
      18  {
      19    u += x;
      20  }
      21  
      22  int
      23  bar (struct S **x, int *y)
      24  {
      25    w += *y;
      26    *y = w + 25;
      27    return 0;
      28  }
      29  
      30  int
      31  baz (struct S **x)
      32  {
      33    struct S *y = *x;
      34    unsigned char *a = y->b;
      35  
      36    foo (*a);
      37  
      38    if (__builtin_expect (y->c != 0 || y->a == &v, 0))
      39      return 1;
      40  
      41    if (__builtin_expect (*a == 1, 0))
      42      {
      43        int a, b = bar (x, &a);
      44  
      45        if (a)
      46  	return b;
      47      }
      48  
      49    return 0;
      50  }
      51  
      52  int
      53  main (void)
      54  {
      55    struct S a, *b = &a;
      56    unsigned char c;
      57  
      58    __builtin_memset (b, 0, sizeof (a));
      59    a.a = &v;
      60    a.b = &c;
      61    if (baz (&b) != 1)
      62      abort ();
      63    exit (0);
      64  }