OSDN Git Service

2008-11-02 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / sms-5.c
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.  */
5
6 extern void abort (void);
7
8 void f (int *p, int **q)
9 {
10   int i;
11   for (i = 0; i < 40; i++)
12     {
13       *q++ = &p[i];
14     }
15 }
16
17 int main ()
18 {
19   void *p;
20   int *q[40];
21   __SIZE_TYPE__ start;
22
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;
32
33   /* Arbitrarily align the pointer.  */
34   start &= -32;
35
36   /* Pretend that's good enough to start address arithmetic.  */
37   p = (void *)start;
38
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 ();
44
45   return 0;
46 }
47