aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr70460.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr70460.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr70460.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70460.c b/gcc/testsuite/gcc.c-torture/execute/pr70460.c
new file mode 100644
index 00000000000..bfecea0932e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr70460.c
@@ -0,0 +1,29 @@
+/* PR rtl-optimization/70460 */
+
+int c;
+
+__attribute__((noinline, noclone)) void
+foo (int x)
+{
+ static int b[] = { &&lab1 - &&lab0, &&lab2 - &&lab0 };
+ void *a = &&lab0 + b[x];
+ goto *a;
+lab1:
+ c += 2;
+lab2:
+ c++;
+lab0:
+ ;
+}
+
+int
+main ()
+{
+ foo (0);
+ if (c != 3)
+ __builtin_abort ();
+ foo (1);
+ if (c != 4)
+ __builtin_abort ();
+ return 0;
+}