[PATCH 3/4] add testcase for missing warning for assignment to const

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

 



The problem is seems to be related with evaluate_dereference()
where all mods are dropped when the type is a node.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/eval/array-quals-node.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 validation/eval/array-quals-node.c

diff --git a/validation/eval/array-quals-node.c b/validation/eval/array-quals-node.c
new file mode 100644
index 000000000000..99a4db13e4da
--- /dev/null
+++ b/validation/eval/array-quals-node.c
@@ -0,0 +1,29 @@
+struct s {
+	int a;
+	int b[3];
+	int c[2][3];
+};
+
+struct c {
+	const struct s s;
+};
+
+extern struct c v;
+
+void f(void)
+{
+	  v.s.a = 0;
+	 *v.s.b = 0;
+	**v.s.c = 0;
+}
+
+/*
+ * check-name: array-quals-node
+ * check-known-to-fail
+ *
+ * check-error-start
+eval/array-quals-node.c:15:14: error: assignment to const expression
+eval/array-quals-node.c:16:14: error: assignment to const expression
+eval/array-quals-node.c:17:14: error: assignment to const expression
+ * check-error-end
+ */
-- 
2.27.0




[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