[PATCH 1/4] add a testcase for assignment to const <type> (*)[]

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

 



You can assign a '<type>[]' to a 'const <type> *'. Likewise,
you can assign a '<type>[][N]' to a 'const <type> (*)[N]' but
sparse doesn't like this.

Analyzed-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
Reported-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/linux-crypto/20200709120937.GA13332@xxxxxxxxxxxxxxxxxxx/
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/eval/array-quals0.c | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 validation/eval/array-quals0.c

diff --git a/validation/eval/array-quals0.c b/validation/eval/array-quals0.c
new file mode 100644
index 000000000000..9cb08c1722d7
--- /dev/null
+++ b/validation/eval/array-quals0.c
@@ -0,0 +1,7 @@
+static int a[2][3];
+static const int (*p)[3] = a;
+
+/*
+ * check-name: array-quals0
+ * check-known-to-fail
+ */
-- 
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