[PATCH 3/4] add tests for nested logical expr

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

 



Nested logical expressions are not correctly linearized.
Add a test for all possible combinations of 2 logical operators.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/linear/logical-phi0.c | 49 ++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 validation/linear/logical-phi0.c

diff --git a/validation/linear/logical-phi0.c b/validation/linear/logical-phi0.c
new file mode 100644
index 000000000..92ba3bc59
--- /dev/null
+++ b/validation/linear/logical-phi0.c
@@ -0,0 +1,49 @@
+int a(void);
+int b(void);
+int c(void);
+
+static int laa(void)
+{
+	return (a() && b()) && c();
+}
+
+static int lao(void)
+{
+	return (a() && b()) || c();
+}
+
+static int loa(void)
+{
+	return (a() || b()) && c();
+}
+
+static int loo(void)
+{
+	return (a() || b()) || c();
+}
+
+static int raa(void)
+{
+	return a() && (b() && c());
+}
+
+static int rao(void)
+{
+	return a() && (b() || c());
+}
+
+static int roa(void)
+{
+	return a() || (b() && c());
+}
+
+static int roo(void)
+{
+	return a() || (b() || c());
+}
+
+/*
+ * check-name: bad-logical-phi0
+ * check-command: sparse -vir -flinearize=last $file
+ * check-known-to-fail
+ */
-- 
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