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

     1  /* { dg-require-effective-target trampolines } */
     2  
     3  extern int foo (int, int, int (*) (int, int, int, int, int, int, int));
     4  
     5  int z;
     6  
     7  int
     8  main (void)
     9  {
    10    int sum = 0;
    11    int i;
    12  
    13    int nested (int a, int b, int c, int d, int e, int f, int g)
    14      {
    15        z = c + d + e + f + g;
    16        
    17        if (a > 2 * b)
    18          return a - b;
    19        else
    20          return b - a;
    21      }
    22  
    23    for (i = 0; i < 10; ++i)
    24      {
    25        int j;
    26  
    27        for (j = 0; j < 10; ++j)
    28          {
    29            int k;
    30  
    31            for (k = 0; k < 10; ++k)
    32              sum += foo (i, j > k ? j - k : k - j, nested);
    33          }
    34      }
    35  
    36    if (sum != 2300)
    37      abort ();
    38  
    39    if (z != 0x1b)
    40      abort ();
    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  }