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

     1  /* PR middle-end/87290 */
     2  
     3  int c;
     4  
     5  __attribute__((noipa)) void
     6  f0 (void)
     7  {
     8    c++;
     9  }
    10  
    11  __attribute__((noipa)) int
    12  f1 (int x)
    13  {
    14    return x % 16 == 13;
    15  }
    16  
    17  __attribute__((noipa)) int
    18  f2 (int x)
    19  {
    20    return x % 16 == -13;
    21  }
    22  
    23  __attribute__((noipa)) void
    24  f3 (int x)
    25  {
    26    if (x % 16 == 13)
    27      f0 ();
    28  }
    29  
    30  __attribute__((noipa)) void
    31  f4 (int x)
    32  {
    33    if (x % 16 == -13)
    34      f0 ();
    35  }
    36  
    37  int
    38  main ()
    39  {
    40    int i, j;
    41    for (i = -30; i < 30; i++)
    42      {
    43        if (f1 (13 + i * 16) != (i >= 0) || f2 (-13 + i * 16) != (i <= 0))
    44  	__builtin_abort ();
    45        f3 (13 + i * 16);
    46        if (c != (i >= 0))
    47  	__builtin_abort ();
    48        f4 (-13 + i * 16);
    49        if (c != 1 + (i == 0))
    50  	__builtin_abort ();
    51        for (j = 1; j < 16; j++)
    52  	{
    53  	  if (f1 (13 + i * 16 + j) || f2 (-13 + i * 16 + j))
    54  	    __builtin_abort ();
    55  	  f3 (13 + i * 16 + j);
    56  	  f4 (-13 + i * 16 + j);
    57  	}
    58        if (c != 1 + (i == 0))
    59  	__builtin_abort ();
    60        c = 0;
    61      }
    62    return 0;
    63  }