aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear/deref-ptr-ptr.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-25 09:58:20 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-12-21 00:33:43 +0100
commit26d547eeb3dff8cad58d314fcc7805b9862eadf5 (patch)
tree0c3281d0fd610f71f726fc02953db6f691e26ba1 /validation/linear/deref-ptr-ptr.c
parent178f19ad47c916ce02b286ec9cf831950340a4ac (diff)
downloadsparse-dev-26d547eeb3dff8cad58d314fcc7805b9862eadf5.tar.gz
add testcases for unexamined base type
evaluate_dereference() lacks an explicit examination of the base type. Most of the time, the base type has already been examined via another path, but in some case, it's not. The symptom here is the dereferenced value having a null size. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear/deref-ptr-ptr.c')
-rw-r--r--validation/linear/deref-ptr-ptr.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/validation/linear/deref-ptr-ptr.c b/validation/linear/deref-ptr-ptr.c
new file mode 100644
index 00000000..022595d7
--- /dev/null
+++ b/validation/linear/deref-ptr-ptr.c
@@ -0,0 +1,27 @@
+char *foo(char **pfmt)
+{
+ return ++*pfmt;
+}
+
+/*
+ * check-name: deref-ptr-ptr
+ * check-command: test-linearize -m64 -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-excludes: load[^.]
+ * check-output-contains: load\.
+ * check-output-excludes: store[^.]
+ * check-output-contains: store\.
+ *
+ * check-output-start
+foo:
+.L0:
+ <entry-point>
+ load.64 %r2 <- 0[%arg1]
+ add.64 %r3 <- %r2, $1
+ store.64 %r3 -> 0[%arg1]
+ ret.64 %r3
+
+
+ * check-output-end
+ */