2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 920302-1.c
blob44a1e9b670e0e22bbff1c59cb233e3da2b7a65c5
1 short optab[5];
2 char buf[10];
3 execute (ip)
4 register short *ip;
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)
12 int i;
13 for (i = 0; i < 3; ++i)
14 optab[i] = (short)(tab[i] - base);
15 return;
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
29 short p[5];
31 main ()
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);