Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/920302-1.c

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