[PATCH v2 01/15] add testcase for (((x & M) | (y & M')) & M'')

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

 



There is a potential problem when the second side of the OR
is simplified away.

Add 2 testcases to catch possible regressions here.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/and-or-crash.c |  5 +++++
 validation/optim/and-or-mask.c  | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 validation/optim/and-or-crash.c
 create mode 100644 validation/optim/and-or-mask.c

diff --git a/validation/optim/and-or-crash.c b/validation/optim/and-or-crash.c
new file mode 100644
index 000000000..49440963c
--- /dev/null
+++ b/validation/optim/and-or-crash.c
@@ -0,0 +1,5 @@
+static int a(int b, unsigned c) { (c << 1 | b & 1 << 1) >> 1; }
+
+/*
+ * check-name: catch crashes during AND-OR simplifications
+ */
diff --git a/validation/optim/and-or-mask.c b/validation/optim/and-or-mask.c
new file mode 100644
index 000000000..468037895
--- /dev/null
+++ b/validation/optim/and-or-mask.c
@@ -0,0 +1,18 @@
+int foo(int a, int b)
+{
+	return ((a & 7) | (b & 3)) & 8;
+}
+
+/*
+ * check-name: and-or-mask
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-start
+foo:
+.L0:
+	<entry-point>
+	ret.32      $0
+
+
+ * check-output-end
+ */
-- 
2.18.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