summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-09-01 18:00:14 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-09-06 02:57:20 +0200
commit39dba5892bba8771e3bcdd0a5257b33ccb3189be (patch)
tree4544fcc673f601e832fe6ad723a480c8b0049a0a
parent4d4dc74a9afa3e11953d7ff230794c83472e60c0 (diff)
downloadsparse-39dba5892bba8771e3bcdd0a5257b33ccb3189be.tar.gz
add tests for nested logical expr
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@gmail.com>
-rw-r--r--validation/linear/logical-phi0.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/validation/linear/logical-phi0.c b/validation/linear/logical-phi0.c
new file mode 100644
index 00000000..92ba3bc5
--- /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
+ */