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  
       9  extern void abort (void);
      10  
      11  int stack_pointer;
      12  
      13  void
      14  __attribute__((noinline))
      15  mystop ()
      16  {
      17    abort ();
      18  }
      19  
      20  void
      21  __attribute__((noinline))
      22  add ()
      23  {
      24    if (stack_pointer + 1 > 10)
      25      mystop ();
      26  
      27    stack_pointer = stack_pointer + 1;
      28  }
      29  
      30  int main ()
      31  {
      32    add ();
      33    return stack_pointer - 1;
      34  }
      35  
      36  /* { dg-final { cleanup-profile-file } } */