[PATCH 03/17] add testcase for addressability of degenerated symbol

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

 



An array or a function that degenerates into a pointer
has its address implicitly taken since the result is
equivalent to '&array[0]' or '&fun'.

So, the corresponding symbol needs to be marked as
addressable, like when its address is explicitly taken.

Add a testcase to illustrate this.

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

diff --git a/validation/eval/addressable-degen.c b/validation/eval/addressable-degen.c
new file mode 100644
index 000000000000..e1dc51079079
--- /dev/null
+++ b/validation/eval/addressable-degen.c
@@ -0,0 +1,18 @@
+extern void def(void *, unsigned int);
+
+static int bar(void)
+{
+	int x[2] = { 1, 2 };
+
+	def(x, sizeof(x));
+	return x[1];
+}
+
+/*
+ * check-name: eval/addressable-degen
+ * check-command: test-linearize -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: load\\.
+ */
-- 
2.24.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