1/* Contributed by Joost VandeVondele  <jv244@cam.ac.uk> */
2
3/* { dg-do run } */
4/* { dg-require-profiling "-pg" } */
5/* { dg-options "-O2 -pg" } */
6/* { dg-options "-O2 -pg -mtune=core2" { target { i?86-*-* x86_64-*-* } } } */
7/* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */
8
9extern void abort (void);
10
11int stack_pointer;
12
13void
14__attribute__((noinline))
15mystop ()
16{
17  abort ();
18}
19
20void
21__attribute__((noinline))
22add ()
23{
24  if (stack_pointer + 1 > 10)
25    mystop ();
26
27  stack_pointer = stack_pointer + 1;
28}
29
30int main ()
31{
32  add ();
33  return stack_pointer - 1;
34}
35
36/* { dg-final { cleanup-profile-file } } */
37