aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/920302-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.c-torture/execute/920302-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.c-torture/execute/920302-1.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/920302-1.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/920302-1.c
new file mode 100644
index 000000000..44a1e9b67
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/920302-1.c
@@ -0,0 +1,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);
+}