modernc.org/cc@v1.0.1/testdata/gcc-6.3.0/gcc/testsuite/gcc.c-torture/execute/920302-1.c (about)

     1  short optab[5];
     2  char buf[10];
     3  execute (ip)
     4       register short *ip;
     5  {
     6  #ifndef NO_LABEL_VALUES
     7    register void *base = &&x;
     8    char *bp = buf;
     9    static void *tab[] = {&&x, &&y, &&z};
    10    if (ip == 0)
    11      {
    12        int i;
    13        for (i = 0; i < 3; ++i)
    14  	optab[i] = (short)(tab[i] - base);
    15        return;
    16      }
    17  x:  *bp++='x';
    18      goto *(base + *ip++);
    19  y:  *bp++='y';
    20      goto *(base + *ip++);
    21  z:  *bp++='z';
    22      *bp=0;
    23      return;
    24  #else
    25      strcpy (buf, "xyxyz");
    26  #endif
    27  }
    28  
    29  short p[5];
    30  
    31  main ()
    32  {
    33    execute ((short *) 0);
    34    p[0] = optab[1];
    35    p[1] = optab[0];
    36    p[2] = optab[1];
    37    p[3] = optab[2];
    38    execute (&p);
    39    if (strcmp (buf, "xyxyz"))
    40      abort ();
    41    exit (0);
    42  }