modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr70460.c (about)

     1  /* { dg-require-effective-target indirect_jumps } */
     2  /* { dg-require-effective-target label_values } */
     3  /* { dg-skip-if "label differences not supported" { avr-*-* } } */
     4  
     5  /* PR rtl-optimization/70460 */
     6  
     7  int c;
     8  
     9  __attribute__((noinline, noclone)) void
    10  foo (int x)
    11  {
    12    static int b[] = { &&lab1 - &&lab0, &&lab2 - &&lab0 };
    13    void *a = &&lab0 + b[x];
    14    goto *a;
    15  lab1:
    16    c += 2;
    17  lab2:
    18    c++;
    19  lab0:
    20    ;
    21  }
    22  
    23  int
    24  main ()
    25  {
    26    foo (0);
    27    if (c != 3)
    28      __builtin_abort ();
    29    foo (1);
    30    if (c != 4)
    31      __builtin_abort ();
    32    return 0;
    33  }