modernc.org/cc@v1.0.1/testdata/gcc-6.3.0/gcc/testsuite/gcc.c-torture/execute/nestfunc-2.c (about)

     1  extern int foo (int, int, int (*) (int, int, int, int, int, int, int));
     2  
     3  int z;
     4  
     5  int
     6  main (void)
     7  {
     8  #ifndef NO_TRAMPOLINES
     9    int sum = 0;
    10    int i;
    11  
    12    int nested (int a, int b, int c, int d, int e, int f, int g)
    13      {
    14        z = c + d + e + f + g;
    15        
    16        if (a > 2 * b)
    17          return a - b;
    18        else
    19          return b - a;
    20      }
    21  
    22    for (i = 0; i < 10; ++i)
    23      {
    24        int j;
    25  
    26        for (j = 0; j < 10; ++j)
    27          {
    28            int k;
    29  
    30            for (k = 0; k < 10; ++k)
    31              sum += foo (i, j > k ? j - k : k - j, nested);
    32          }
    33      }
    34  
    35    if (sum != 2300)
    36      abort ();
    37  
    38    if (z != 0x1b)
    39      abort ();
    40  #endif
    41    
    42    exit (0);
    43  }
    44  
    45  int
    46  foo (int a, int b, int (* fp) (int, int, int, int, int, int, int))
    47  {
    48    return fp (a, b, a, b, a, b, a);
    49  }