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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [nestfunc-3.c] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
 
2
extern long foo (long, long, long (*) (long, long));
3
extern long use (long (*) (long, long), long, long);
4
 
5
int
6
main (void)
7
{
8
#ifndef NO_TRAMPOLINES
9
  long sum = 0;
10
  long i;
11
 
12
  long nested_0 (long a, long b)
13
    {
14
      if (a > 2 * b)
15
        return a - b;
16
      else
17
        return b - a;
18
    }
19
 
20
  long nested_1 (long a, long b)
21
    {
22
      return use (nested_0, b, a) + sum;
23
    }
24
 
25
  long nested_2 (long a, long b)
26
    {
27
      return nested_1 (b, a);
28
    }
29
 
30
  for (i = 0; i < 10; ++i)
31
    {
32
      long j;
33
 
34
      for (j = 0; j < 10; ++j)
35
        {
36
          long k;
37
 
38
          for (k = 0; k < 10; ++k)
39
            sum += foo (i, j > k ? j - k : k - j, nested_2);
40
        }
41
    }
42
 
43
  if ((sum & 0xffffffff) != 0xbecfcbf5)
44
    abort ();
45
#endif
46
 
47
  exit (0);
48
}
49
 
50
long
51
use (long (* func)(long, long), long a, long b)
52
{
53
  return func (b, a);
54
}
55
 
56
long
57
foo (long a, long b, long (* func) (long, long))
58
{
59
  return func (a, b);
60
}

powered by: WebSVN 2.1.0

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