modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr47337.c (about)

     1  /* PR rtl-optimization/47337 */
     2  
     3  static unsigned int a[256], b = 0;
     4  static char c = 0;
     5  static int d = 0, *f = &d;
     6  static long long e = 0;
     7  
     8  static short
     9  foo (long long x, long long y)
    10  {
    11    return x / y;
    12  }
    13  
    14  static char
    15  bar (char x, char y)
    16  {
    17    return x - y;
    18  }
    19  
    20  static int
    21  baz (int x, int y)
    22  {
    23    *f = (y != (short) (y * 3));
    24    for (c = 0; c < 2; c++)
    25      {
    26      lab:
    27        if (d)
    28  	{
    29  	  if (e)
    30  	    e = 1;
    31  	  else
    32  	    return x;
    33  	}
    34        else
    35  	{
    36  	  d = 1;
    37  	  goto lab;
    38  	}
    39        f = &d;
    40      }
    41    return x;
    42  }
    43  
    44  static void
    45  fnx (unsigned long long x, int y)
    46  {
    47    if (!y)
    48      {
    49        b = a[b & 1];
    50        b = a[b & 1];
    51        b = a[(b ^ (x & 1)) & 1];
    52        b = a[(b ^ (x & 1)) & 1];
    53      }
    54  }
    55  
    56  char *volatile w = "2";
    57  
    58  int
    59  main ()
    60  {
    61    int h = 0;
    62    unsigned int k = 0;
    63    int l[8];
    64    int i, j;
    65  
    66    if (__builtin_strcmp (w, "1") == 0)
    67      h = 1;
    68  
    69    for (i = 0; i < 256; i++)
    70      {
    71        for (j = 8; j > 0; j--)
    72  	k = 1;
    73        a[i] = k;
    74      }
    75    for (i = 0; i < 8; i++)
    76      l[i] = 0;
    77  
    78    d = bar (c, c);
    79    d = baz (c, 1 | foo (l[0], 10));
    80    fnx (d, h);
    81    fnx (e, h);
    82  
    83    if (d != 0)
    84      __builtin_abort ();
    85    return 0;
    86  }