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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [sibcall-1.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Simple check that sibling calls are performed from a
2
   void non-leaf-function taking one int argument calling itself.
3
 
4
   Copyright (C) 2002 Free Software Foundation Inc.
5
   Contributed by Hans-Peter Nilsson  <hp@bitrange.com>  */
6
 
7
/* { dg-do run } */
8
/* { dg-options "-O2 -foptimize-sibling-calls" } */
9
 
10
/* The option -foptimize-sibling-calls is the default, but serves as
11
   marker.  Self-recursion tail calls are optimized for all targets,
12
   regardless of presence of sibcall patterns.  */
13
 
14
extern void abort (void);
15
extern void exit (int);
16
 
17
extern void recurser_void (int);
18
extern void track (int);
19
 
20
int main ()
21
{
22
  recurser_void (0);
23
  exit (0);
24
}
25
 
26
void
27
recurser_void (int n)
28
{
29
  if (n == 0 || n == 7)
30
    track (n);
31
 
32
  if (n == 10)
33
    return;
34
 
35
  recurser_void (n + 1);
36
}
37
 
38
void *trackpoint;
39
 
40
void __attribute__ ((noinline))
41
track (int n)
42
{
43
  char stackpos[1];
44
 
45
  if (n == 0)
46
    trackpoint = stackpos;
47
  else if (n != 7 || trackpoint != stackpos)
48
    abort ();
49
}

powered by: WebSVN 2.1.0

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