1  /* Same test as built-in-setjmp.c.  Includes the case where
       2     the source block of a crossing fallthru edge ends with a call.  */
       3  /* { dg-require-effective-target freorder } */
       4  /* { dg-options "-O2 -freorder-blocks-and-partition" } */
       5  
       6  extern int strcmp(const char *, const char *);
       7  extern char *strcpy(char *, const char *);
       8  extern void abort(void);
       9  extern void exit(int);
      10  
      11  void *buf[20];
      12  
      13  void __attribute__((noinline))
      14  sub2 (void)
      15  {
      16    __builtin_longjmp (buf, 1);
      17  }
      18  
      19  int
      20  main ()
      21  {
      22    char *p = (char *) __builtin_alloca (20);
      23  
      24    strcpy (p, "test");
      25  
      26    if (__builtin_setjmp (buf))
      27      {
      28        if (strcmp (p, "test") != 0)
      29  	abort ();
      30  
      31        exit (0);
      32      }
      33  
      34    {
      35      int *q = (int *) __builtin_alloca (p[2] * sizeof (int));
      36      int i;
      37      
      38      for (i = 0; i < p[2]; i++)
      39        q[i] = 0;
      40  
      41      while (1)
      42        sub2 ();
      43    }
      44  }
      45