summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c b/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c
new file mode 100644
index 000000000..771cd9569
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c
@@ -0,0 +1,36 @@
+/* A slight variation of 920501-7.c. */
+
+#ifdef STACK_SIZE
+#define DEPTH ((STACK_SIZE) / 512 + 1)
+#else
+#define DEPTH 1000
+#endif
+
+#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+x(a)
+{
+ __label__ xlab;
+ void y(a)
+ {
+ void *x = &&llab;
+ if (a==-1)
+ goto *x;
+ if (a==0)
+ goto xlab;
+ llab:
+ y (a-1);
+ }
+ y (a);
+ xlab:;
+ return a;
+}
+#endif
+
+main ()
+{
+#if ! defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES)
+ if (x (DEPTH) != DEPTH)
+ abort ();
+#endif
+ exit (0);
+}