test for computed goto
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 1 Sep 2008 00:01:55 +0000 (00:01 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 1 Sep 2008 00:01:55 +0000 (00:01 +0000)
[r21608]

parsetest/gnu99/computed_goto.c [new file with mode: 0644]

diff --git a/parsetest/gnu99/computed_goto.c b/parsetest/gnu99/computed_goto.c
new file mode 100644 (file)
index 0000000..f266b93
--- /dev/null
@@ -0,0 +1,12 @@
+int test(int x) {
+       static void *array[] = { &&foo, &&bar, &&hack };
+
+       goto *array[x];
+foo:   return 1;
+bar:   return 2;
+hack:  return 3;
+}
+
+int main(int argc, char *argv[]) {
+       return test(1) == 2 ? 0 : 1;
+}