(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
pr60003.c
       1  /* PR tree-optimization/60003 */
       2  /* { dg-require-effective-target indirect_jumps } */
       3  
       4  extern void abort (void);
       5  
       6  unsigned long long jmp_buf[5];
       7  
       8  __attribute__((noinline, noclone)) void
       9  baz (void)
      10  {
      11    __builtin_longjmp (&jmp_buf, 1);
      12  }
      13  
      14  void
      15  bar (void)
      16  {
      17    baz ();
      18  }
      19  
      20  __attribute__((noinline, noclone)) int
      21  foo (int x)
      22  {
      23    int a = 0;
      24  
      25    if (__builtin_setjmp (&jmp_buf) == 0)
      26      {
      27        while (1)
      28  	{
      29  	  a = 1;
      30  	  bar ();  /* OK if baz () instead */
      31  	}
      32      }
      33    else
      34      {
      35        if (a == 0)
      36  	return 0;
      37        else
      38  	return x;
      39      }
      40  }
      41  
      42  int
      43  main ()
      44  {
      45    if (foo (1) == 0)
      46      abort ();
      47  
      48    return 0;
      49  }