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

     1  /* PR rtl-optimization/19579 */
     2  
     3  extern void abort (void);
     4  
     5  int
     6  foo (int i, int j)
     7  {
     8    int k = i + 1;
     9  
    10    if (j)
    11      {
    12        if (k > 0)
    13  	k++;
    14        else if (k < 0)
    15  	k--;
    16      }
    17  
    18    return k;
    19  }
    20  
    21  int
    22  main (void)
    23  {
    24    if (foo (-2, 0) != -1)
    25      abort ();
    26    if (foo (-1, 0) != 0)
    27      abort ();
    28    if (foo (0, 0) != 1)
    29      abort ();
    30    if (foo (1, 0) != 2)
    31      abort ();
    32    if (foo (-2, 1) != -2)
    33      abort ();
    34    if (foo (-1, 1) != 0)
    35      abort ();
    36    if (foo (0, 1) != 2)
    37      abort ();
    38    if (foo (1, 1) != 3)
    39      abort ();
    40    return 0;
    41  }