[PATCH 02/15] add test case for VLA sizeof

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

 



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

diff --git a/validation/vla-sizeof.c b/validation/vla-sizeof.c
new file mode 100644
index 000000000..43079992c
--- /dev/null
+++ b/validation/vla-sizeof.c
@@ -0,0 +1,37 @@
+unsigned long vla_sizeof0(int size)
+{
+	int a[size];
+	return sizeof(a);
+}
+
+unsigned long vla_sizeof1(int size)
+{
+	struct s {
+		int a[size];
+	};
+	return sizeof(struct s);
+}
+
+unsigned long vla_sizeof2(int size)
+{
+	struct s {
+		int a[size];
+	} *p;
+	return sizeof(*p);
+}
+
+void* vla_inc(int size, void *base)
+{
+	struct s {
+		int a[size];
+	} *p = base;
+
+	++p;
+	return p;
+}
+
+/*
+ * check-name: vla-sizeof.c
+ *
+ * check-known-to-fail
+ */
-- 
2.14.0

--
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