2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / loop-15.c
blob8cb5125a29ea691731155d245c819a0fcf8a2822
1 /* Bombed with a segfault on powerpc-linux. doloop.c generated wrong
2 loop count. */
3 void
4 foo (unsigned long *start, unsigned long *end)
6 unsigned long *temp = end - 1;
8 while (end > start)
9 *end-- = *temp--;
12 int
13 main (void)
15 unsigned long a[5];
16 int start, end, k;
18 for (start = 0; start < 5; start++)
19 for (end = 0; end < 5; end++)
21 for (k = 0; k < 5; k++)
22 a[k] = k;
24 foo (a + start, a + end);
26 for (k = 0; k <= start; k++)
27 if (a[k] != k)
28 abort ();
30 for (k = start + 1; k <= end; k++)
31 if (a[k] != k - 1)
32 abort ();
34 for (k = end + 1; k < 5; k++)
35 if (a[k] != k)
36 abort ();
39 return 0;