]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gcc.dg/sibcall-6.c
re PR c++/14267 (ICE on invalid, cast to lval related)
[gcc.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-*-* x86_64-*-*} } */
10 /* { dg-options "-O2 -foptimize-sibling-calls" } */
11
12 int foo (int);
13 int bar (int);
14
15 int (*ptr) (int);
16 int *f_addr;
17
18 int
19 main ()
20 {
21 ptr = bar;
22 foo (7);
23 exit (0);
24 }
25
26 int
27 bar (b)
28 int b;
29 {
30 if (f_addr == (int*) __builtin_return_address (0))
31 return b;
32 else
33 abort ();
34 }
35
36 int
37 foo (f)
38 int f;
39 {
40 f_addr = (int*) __builtin_return_address (0);
41 return (*ptr)(f);
42 }
This page took 0.038197 seconds and 5 git commands to generate.