OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / sibcall-6.c
1 /* A simple check to see whether indirect calls are
2    being sibcall optimized on targets that do support
3    this notion, i.e. have the according call patterns
4    in place.
5
6    Copyright (C) 2002 Free Software Foundation Inc.
7    Contributed by Andreas Bauer <baueran@in.tum.de>  */
8
9 /* { dg-do run { target i?86-*-* s390*-*-* x86_64-*-*} } */
10 /* { dg-options "-O2 -foptimize-sibling-calls" } */
11
12 extern void abort (void);
13 extern void exit (int);
14
15 int foo (int);
16 int bar (int);
17
18 int (*ptr) (int);
19 int *f_addr;
20
21 int
22 main ()
23 {
24   ptr = bar;
25   foo (7);
26   exit (0);
27 }
28
29 int
30 bar (b)
31      int b;
32 {
33   if (f_addr == (int*) __builtin_return_address (0))
34     return b;
35   else
36     abort ();
37 }
38
39 int
40 foo (f)
41      int f;
42 {
43   f_addr = (int*) __builtin_return_address (0);
44   return (*ptr)(f);
45 }