OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [loop-15.c] - Blame information for rev 717

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Bombed with a segfault on powerpc-linux.  doloop.c generated wrong
2
   loop count.  */
3
void
4
foo (unsigned long *start, unsigned long *end)
5
{
6
  unsigned long *temp = end - 1;
7
 
8
  while (end > start)
9
    *end-- = *temp--;
10
}
11
 
12
int
13
main (void)
14
{
15
  unsigned long a[5];
16
  int start, end, k;
17
 
18
  for (start = 0; start < 5; start++)
19
    for (end = 0; end < 5; end++)
20
      {
21
        for (k = 0; k < 5; k++)
22
          a[k] = k;
23
 
24
        foo (a + start, a + end);
25
 
26
        for (k = 0; k <= start; k++)
27
          if (a[k] != k)
28
            abort ();
29
 
30
        for (k = start + 1; k <= end; k++)
31
          if (a[k] != k - 1)
32
            abort ();
33
 
34
        for (k = end + 1; k < 5; k++)
35
          if (a[k] != k)
36
            abort ();
37
      }
38
 
39
  return 0;
40
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.