1  /* { dg-require-effective-target indirect_jumps } */
       2  /* { dg-additional-options "-fomit-frame-pointer -fno-inline" }  */
       3  
       4  extern void abort (void);
       5  
       6  void
       7  broken_longjmp (void *p)
       8  {
       9    __builtin_longjmp (p, 1);
      10  }
      11  
      12  volatile int x = 256;
      13  void *volatile p = (void*)&x;
      14  void *volatile p1;
      15  
      16  void
      17  test (void)
      18  {
      19    void *buf[5];
      20    void *volatile q = p;
      21  
      22    if (!__builtin_setjmp (buf))
      23      broken_longjmp (buf);
      24  
      25    /* Fails if stack pointer corrupted.  */
      26    if (p != q)
      27      abort ();
      28  }
      29  
      30  void
      31  test2 (void)
      32  {
      33    void *volatile q = p;
      34    p1 = __builtin_alloca (x);
      35    test ();
      36  
      37    /* Fails if frame pointer corrupted.  */
      38    if (p != q)
      39      abort ();
      40  }
      41  
      42  int
      43  main (void)
      44  {
      45    void *volatile q = p;
      46    test ();
      47    test2 ();
      48    /* Fails if stack pointer corrupted.  */
      49    if (p != q)
      50      abort ();
      51  
      52    return 0;
      53  }