aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
Diffstat (limited to 'validation')
-rw-r--r--validation/badtype5.c18
-rw-r--r--validation/linear/missing-insn-size.c19
2 files changed, 37 insertions, 0 deletions
diff --git a/validation/badtype5.c b/validation/badtype5.c
new file mode 100644
index 00000000..c3c34ab2
--- /dev/null
+++ b/validation/badtype5.c
@@ -0,0 +1,18 @@
+#define __force __attribute__((force))
+
+int foo(int *addr);
+int foo(int *addr)
+{
+ return *(*((typeof(addr) __force *) addr));
+}
+
+/*
+ * check-name: badtype5.c
+ * check-description:
+ * evaluate_dereference() used to miss a call to
+ * examine_symbol_type(). This, in the present, left
+ * a SYM_TYPEOF as type for the last dereferencing
+ * which produced "error: cannot dereference this type".
+ * The presence of the __force and the typeof is needed
+ * to create the situation.
+ */
diff --git a/validation/linear/missing-insn-size.c b/validation/linear/missing-insn-size.c
new file mode 100644
index 00000000..fe588634
--- /dev/null
+++ b/validation/linear/missing-insn-size.c
@@ -0,0 +1,19 @@
+int foo(int **a);
+int foo(int **a)
+{
+ return **a;
+}
+
+/*
+ * check-name: missing instruction's size
+ * check-description:
+ * sparse used to have a problem with *all*
+ * double dereferencing due to missing a
+ * call to examine_symbol_type(). The symptom
+ * here is that the inner deref had no type.
+ * check-command: test-linearize $file
+ * check-output-ignore
+ *
+ * check-output-excludes: load\\s
+ * check-output-contains: load\\.
+ */