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

     1  extern void abort(void);
     2  
     3  int test1(char x)
     4  {
     5    return x/100 == 3;
     6  }
     7  
     8  int test1u(unsigned char x)
     9  {
    10    return x/100 == 3;
    11  }
    12  
    13  int test2(char x)
    14  {
    15    return x/100 != 3;
    16  }
    17  
    18  int test2u(unsigned char x)
    19  {
    20    return x/100 != 3;
    21  }
    22  
    23  int test3(char x)
    24  {
    25    return x/100 < 3;
    26  }
    27  
    28  int test3u(unsigned char x)
    29  {
    30    return x/100 < 3;
    31  }
    32  
    33  int test4(char x)
    34  {
    35    return x/100 <= 3;
    36  }
    37  
    38  int test4u(unsigned char x)
    39  {
    40    return x/100 <= 3;
    41  }
    42  
    43  int test5(char x)
    44  {
    45    return x/100 > 3;
    46  }
    47  
    48  int test5u(unsigned char x)
    49  {
    50    return x/100 > 3;
    51  }
    52  
    53  int test6(char x)
    54  {
    55    return x/100 >= 3;
    56  }
    57  
    58  int test6u(unsigned char x)
    59  {
    60    return x/100 >= 3;
    61  }
    62  
    63  
    64  int main()
    65  {
    66    int c;
    67  
    68    for (c=-128; c<256; c++)
    69    {
    70      if (test1(c) != 0)
    71        abort ();
    72      if (test1u(c) != 0)
    73        abort ();
    74      if (test2(c) != 1)
    75        abort ();
    76      if (test2u(c) != 1)
    77        abort ();
    78      if (test3(c) != 1)
    79        abort ();
    80      if (test3u(c) != 1)
    81        abort ();
    82      if (test4(c) != 1)
    83        abort ();
    84      if (test4u(c) != 1)
    85        abort ();
    86      if (test5(c) != 0)
    87        abort ();
    88      if (test5u(c) != 0)
    89        abort ();
    90      if (test6(c) != 0)
    91        abort ();
    92      if (test6u(c) != 0)
    93        abort ();
    94    }
    95    return 0;
    96  }
    97