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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [nestfunc-4.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
/* Origin: hp@bitrange.com
2
   Test that return values come out right from a 1000-level call chain to
3
   functions without parameters that each need at least one "long"
4
   preserved.  Exposed problems related to the MMIX port.  */
5
 
6
long level = 0;
7
extern long foo (void);
8
extern long bar (void);
9
 
10
#ifdef STACK_SIZE
11
#define DEPTH ((STACK_SIZE) / 512 + 1)
12
#else
13
#define DEPTH 500
14
#endif
15
 
16
int
17
main (void)
18
{
19
  if (foo () == -42)
20
    exit (0);
21
 
22
  abort ();
23
}
24
 
25
long
26
foo (void)
27
{
28
  long tmp = ++level;
29
  return bar () + tmp;
30
}
31
 
32
long
33
bar (void)
34
{
35
  long tmp = level;
36
  return tmp > DEPTH - 1 ? -42 - tmp : foo () - tmp;
37
}

powered by: WebSVN 2.1.0

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