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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [sibcall-2.c] - Blame information for rev 298

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 no arguments 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 (void);
18
extern void track (void);
19
 
20
int n = 0;
21
int main ()
22
{
23
  recurser_void ();
24
  exit (0);
25
}
26
 
27
void
28
recurser_void (void)
29
{
30
  if (n == 0 || n == 7)
31
    track ();
32
 
33
  if (n == 10)
34
    return;
35
  n++;
36
  recurser_void ();
37
}
38
 
39
void *trackpoint;
40
 
41
void __attribute__ ((noinline))
42
track ()
43
{
44
  char stackpos[1];
45
 
46
  if (n == 0)
47
    trackpoint = stackpos;
48
  else if (n != 7 || trackpoint != stackpos)
49
    abort ();
50
}

powered by: WebSVN 2.1.0

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