aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim
diff options
Diffstat (limited to 'validation/optim')
-rw-r--r--validation/optim/cgoto01.c24
-rw-r--r--validation/optim/cgoto02.c17
-rw-r--r--validation/optim/cse-label.c13
3 files changed, 54 insertions, 0 deletions
diff --git a/validation/optim/cgoto01.c b/validation/optim/cgoto01.c
new file mode 100644
index 00000000..94b2c2c4
--- /dev/null
+++ b/validation/optim/cgoto01.c
@@ -0,0 +1,24 @@
+void abort(void) __attribute__((__noreturn__));
+
+int foo(int a)
+{
+ void *label;
+
+ if (a == a)
+ label = &&L1;
+ else
+ label = &&L2;
+ goto *label;
+L1: return 0;
+L2: abort();
+}
+
+/*
+ * check-name: cgoto01
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-excludes: set\\.
+ * check-output-excludes: jmp
+ * check-output-excludes: call
+ */
diff --git a/validation/optim/cgoto02.c b/validation/optim/cgoto02.c
new file mode 100644
index 00000000..932c3164
--- /dev/null
+++ b/validation/optim/cgoto02.c
@@ -0,0 +1,17 @@
+int foo(int a)
+{
+ void *label = a ? &&l1 : &&l2;
+ goto *label;
+l1:
+ return a;
+l2:
+ return 0;
+}
+
+/*
+ * check-name: cgoto02
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-returns: %arg1
+ */
diff --git a/validation/optim/cse-label.c b/validation/optim/cse-label.c
new file mode 100644
index 00000000..c3b552d3
--- /dev/null
+++ b/validation/optim/cse-label.c
@@ -0,0 +1,13 @@
+int foo(void)
+{
+label:
+ return &&label == &&label;
+}
+
+/*
+ * check-name: cse-label
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */