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

short p[5];

main ()
{
  execute ((short *) 0);
  p[0] = optab[1];
  p[1] = optab[0];
  p[2] = optab[1];
  p[3] = optab[2];
  execute (&p);
  if (strcmp (buf, "xyxyz"))
    abort ();
  exit (0);
}