1 /* { dg-do run } */ 2 /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -funroll-loops -fdump-rtl-sms --param sms-min-sc=1" } */ 3 /* This is the same test as loop-2e.c test. It is related to a fix in 4 the generation of the prolog and epilog. */ 5 6 extern void abort (void); 7 8 __attribute__ ((noinline)) f(int * p,int ** q)9void f (int *p, int **q) 10 { 11 int i; 12 for (i = 0; i < 40; i++) 13 { 14 *q++ = &p[i]; 15 } 16 } 17 main()18int main () 19 { 20 void *p; 21 int *q[40]; 22 __SIZE_TYPE__ start; 23 24 /* Find the signed middle of the address space. */ 25 if (sizeof(start) == sizeof(int)) 26 start = (__SIZE_TYPE__) __INT_MAX__; 27 else if (sizeof(start) == sizeof(long)) 28 start = (__SIZE_TYPE__) __LONG_MAX__; 29 else if (sizeof(start) == sizeof(long long)) 30 start = (__SIZE_TYPE__) __LONG_LONG_MAX__; 31 else 32 return 0; 33 34 /* Arbitrarily align the pointer. */ 35 start &= -32; 36 37 /* Pretend that's good enough to start address arithmetic. */ 38 p = (void *)start; 39 40 /* Verify that GIV replacement computes the correct results. */ 41 q[39] = 0; 42 f (p, q); 43 if (q[39] != (int *)p + 39) 44 abort (); 45 46 return 0; 47 } 48 49 50 51