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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr48571-1.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 688 jeremybenn
#define S (sizeof (int))
2
 
3
unsigned int c[624];
4
void __attribute__((noinline))
5
bar (void)
6
{
7
  unsigned int i;
8
  /* Obfuscated c[i] = c[i-1] * 2.  */
9
  for (i = 1; i < 624; ++i)
10
    *(unsigned int *)((void *)c + (__SIZE_TYPE__)i * S)
11
        = 2 * *(unsigned int *)((void *)c + ((__SIZE_TYPE__)i +
12
                                             ((__SIZE_TYPE__)-S)/S) * S);
13
}
14
extern void abort (void);
15
int
16
main()
17
{
18
  unsigned int i, j;
19
  for (i = 0; i < 624; ++i)
20
    c[i] = 1;
21
  bar();
22
  j = 1;
23
  for (i = 0; i < 624; ++i)
24
    {
25
      if (c[i] != j)
26
        abort ();
27
      j = j * 2;
28
    }
29
  return 0;
30
}

powered by: WebSVN 2.1.0

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