[PATCH 1/4] add testcases for COMPUTEDGOTO simplification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/cgoto01.c   | 25 +++++++++++++++++++++++++
 validation/optim/cgoto02.c   | 18 ++++++++++++++++++
 validation/optim/cse-label.c | 14 ++++++++++++++
 3 files changed, 57 insertions(+)
 create mode 100644 validation/optim/cgoto01.c
 create mode 100644 validation/optim/cgoto02.c
 create mode 100644 validation/optim/cse-label.c

diff --git a/validation/optim/cgoto01.c b/validation/optim/cgoto01.c
new file mode 100644
index 000000000000..350c6cd99f08
--- /dev/null
+++ b/validation/optim/cgoto01.c
@@ -0,0 +1,25 @@
+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-known-to-fail
+ *
+ * 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 000000000000..5869d5b4a24d
--- /dev/null
+++ b/validation/optim/cgoto02.c
@@ -0,0 +1,18 @@
+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-known-to-fail
+ *
+ * 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 000000000000..e42968204615
--- /dev/null
+++ b/validation/optim/cse-label.c
@@ -0,0 +1,14 @@
+int foo(void)
+{
+label:
+	return &&label == &&label;
+}
+
+/*
+ * check-name: cse-label
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
-- 
2.29.2




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux