2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / sms-5.c
blob9c2e0165c566055a95f203d828d138f222c89fdf
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -funroll-loops" } */
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. */
6 extern void abort (void);
8 void f (int *p, int **q)
10 int i;
11 for (i = 0; i < 40; i++)
13 *q++ = &p[i];
17 int main ()
19 void *p;
20 int *q[40];
21 __SIZE_TYPE__ start;
23 /* Find the signed middle of the address space. */
24 if (sizeof(start) == sizeof(int))
25 start = (__SIZE_TYPE__) __INT_MAX__;
26 else if (sizeof(start) == sizeof(long))
27 start = (__SIZE_TYPE__) __LONG_MAX__;
28 else if (sizeof(start) == sizeof(long long))
29 start = (__SIZE_TYPE__) __LONG_LONG_MAX__;
30 else
31 return 0;
33 /* Arbitrarily align the pointer. */
34 start &= -32;
36 /* Pretend that's good enough to start address arithmetic. */
37 p = (void *)start;
39 /* Verify that GIV replacement computes the correct results. */
40 q[39] = 0;
41 f (p, q);
42 if (q[39] != (int *)p + 39)
43 abort ();
45 return 0;