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

     1  void f (int *p, int **q)
     2  {
     3    int i;
     4    for (i = 0; i < 40; i++)
     5      {
     6        *q++ = &p[i];
     7      }
     8  }
     9  
    10  int main ()
    11  {
    12    void *p;
    13    int *q[40];
    14    __SIZE_TYPE__ start;
    15  
    16    /* Find the signed middle of the address space.  */
    17    if (sizeof(start) == sizeof(int))
    18      start = (__SIZE_TYPE__) __INT_MAX__;
    19    else if (sizeof(start) == sizeof(long))
    20      start = (__SIZE_TYPE__) __LONG_MAX__;
    21    else if (sizeof(start) == sizeof(long long))
    22      start = (__SIZE_TYPE__) __LONG_LONG_MAX__;
    23    else
    24      return 0;
    25  
    26    /* Arbitrarily align the pointer.  */
    27    start &= -32;
    28  
    29    /* Pretend that's good enough to start address arithmetic.  */
    30    p = (void *)start;
    31  
    32    /* Verify that GIV replacement computes the correct results.  */
    33    q[39] = 0;
    34    f (p, q);
    35    if (q[39] != (int *)p + 39)
    36      abort ();
    37  
    38    return 0;
    39  }