[PATCH 1/2] eval_insn: add testcases for incorrect type in OP_SET_*

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

 



Because of the lack of type information, compare instruction are
not always handled correctly. So, add some testcases for this.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/cmp-op-type.c | 18 ++++++++++++++++++
 validation/optim/cmp-type0.c   | 13 +++++++++++++
 validation/optim/cmp-type1.c   | 16 ++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 validation/optim/cmp-op-type.c
 create mode 100644 validation/optim/cmp-type0.c
 create mode 100644 validation/optim/cmp-type1.c

diff --git a/validation/optim/cmp-op-type.c b/validation/optim/cmp-op-type.c
new file mode 100644
index 000000000000..037272f84465
--- /dev/null
+++ b/validation/optim/cmp-op-type.c
@@ -0,0 +1,18 @@
+extern int get(void);
+
+static int array[8192];
+
+static int foo(void)
+{
+	int n = -1;
+	if (n < 0)
+		n = get();
+	return array[n];
+}
+
+/*
+ * check-name: cmp-op-type
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ */
diff --git a/validation/optim/cmp-type0.c b/validation/optim/cmp-type0.c
new file mode 100644
index 000000000000..695d082b6aed
--- /dev/null
+++ b/validation/optim/cmp-type0.c
@@ -0,0 +1,13 @@
+static int foo(long long a)
+{
+	return 0LL < (0x80000000LL + (a - a));
+}
+
+/*
+ * check-name: cmp-type0
+ * check-command: test-linearize $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: ret.*\\$1
+ */
diff --git a/validation/optim/cmp-type1.c b/validation/optim/cmp-type1.c
new file mode 100644
index 000000000000..2fb78a0bb86a
--- /dev/null
+++ b/validation/optim/cmp-type1.c
@@ -0,0 +1,16 @@
+int foo(void)
+{
+	int r;
+	long n;
+	n = 0;
+	return n < 2147483648U;
+}
+
+/*
+ * check-name: cmp-type1
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
-- 
2.29.0




[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