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

     1  /* PR rtl-optimization/83496 */
     2  /* Reported by Hauke Mehrtens <gcc@hauke-m.de> */
     3  
     4  extern void abort (void);
     5  
     6  typedef unsigned long mp_digit;
     7  
     8  typedef struct { int used, alloc, sign; mp_digit *dp; } mp_int;
     9  
    10  int mytest(mp_int *a, mp_digit b) __attribute__((noclone, noinline));
    11  
    12  int mytest(mp_int *a, mp_digit b)
    13  {
    14    if (a->sign == 1)
    15      return -1;
    16    if (a->used > 1)
    17      return 1;
    18    if (a->dp[0] > b)
    19      return 1;
    20    if (a->dp[0] < b)
    21      return -1;
    22    return 0;
    23  }
    24  
    25  int main (void)
    26  {
    27    mp_int i = { 2, 0, -1 };
    28    if (mytest (&i, 0) != 1)
    29      abort ();
    30    return 0;
    31  }