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

     1  /* Test whether a partly call-clobbered register will be moved over a call.
     2     Although the original test case didn't use any GNUisms, it proved
     3     difficult to reduce without the named register extension.  */
     4  #if __SH64__ == 32
     5  #define LOC asm ("r10")
     6  #else
     7  #define LOC
     8  #endif
     9  
    10  unsigned int foo (char *c, unsigned int x, unsigned int y)
    11  {
    12    register unsigned int z LOC;
    13  
    14    sprintf (c, "%d", x / y);
    15    z = x + 1;
    16    return z / (y + 1);
    17  }
    18  
    19  int main ()
    20  {
    21    char c[16];
    22  
    23    if (foo (c, ~1U, 4) != (~0U / 5))
    24      abort ();
    25    exit (0);
    26  }