[PATCH 1/5] symaddr: add test cases

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

 



Add a few testcases showing problems introduced with the removal
of OP_SYMADDRs.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/mem2reg/address-used00.c |  1 +
 validation/symaddr-op.c             | 18 ++++++++++++++++++
 validation/symaddr.c                | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 validation/symaddr-op.c
 create mode 100644 validation/symaddr.c

diff --git a/validation/mem2reg/address-used00.c b/validation/mem2reg/address-used00.c
index f2d6c87bd..a41f05c25 100644
--- a/validation/mem2reg/address-used00.c
+++ b/validation/mem2reg/address-used00.c
@@ -16,4 +16,5 @@ int foo(int **g, int j)
  * check-known-to-fail
  * check-output-ignore
  * check-output-excludes: ret\\..* \\$1
+ * check-output-contains: ret\\..* \\$0
  */
diff --git a/validation/symaddr-op.c b/validation/symaddr-op.c
new file mode 100644
index 000000000..c17c328f8
--- /dev/null
+++ b/validation/symaddr-op.c
@@ -0,0 +1,18 @@
+struct s {
+	int c;
+	char a[];
+} s;
+
+char foo(int *ptr, long i)
+{
+	return s.a[i];
+}
+
+/*
+ * check-name: symaddr-op
+ * check-command: test-linearize -m64 -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: add.64 .* <- s,
+ */
diff --git a/validation/symaddr.c b/validation/symaddr.c
new file mode 100644
index 000000000..97f640f91
--- /dev/null
+++ b/validation/symaddr.c
@@ -0,0 +1,32 @@
+int g;
+int a[3];
+int b[3];
+
+void usep(int*);
+
+int foo(void)
+{
+	int r = 0;
+	usep(&g);
+	usep(a);
+	usep(b + 1);
+	return r;
+}
+
+/*
+ * check-name: symaddr
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-start
+foo:
+.L0:
+	<entry-point>
+	call        usep, g
+	call        usep, a
+	add.64      %r4 <- b, $4
+	call        usep, %r4
+	ret.32      $0
+
+
+ * check-output-end
+ */
-- 
2.16.2

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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