(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr46685.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target freorder } */
       3  /* { dg-require-effective-target fpic } */
       4  /* { dg-options "-O2 -freorder-blocks-and-partition -fpic" } */
       5  
       6  __attribute__((noinline, noclone))
       7  void bar (void *x)
       8  {
       9    asm volatile ("" : : "r" (x) : "memory");
      10  }
      11  
      12  __attribute__((noinline, noclone))
      13  void baz (void)
      14  {
      15    asm volatile ("" : : : "memory");
      16  }
      17  
      18  __attribute__((noinline, noclone))
      19  int foo (int x)
      20  {
      21    __label__ lab;
      22    if (__builtin_expect (x, 0))
      23      {
      24        lab:
      25        baz ();
      26        return 2;
      27      }
      28    bar (&&lab);
      29    return 1;
      30  }
      31  
      32  int
      33  main (void)
      34  {
      35    int x, i;
      36    asm volatile ("" : "=r" (x) : "0" (0));
      37    for (i = 0; i < 1000000; i++)
      38      foo (x);
      39    return 0;
      40  }