diff mbox series

[04/17] add testcase for addressability of 'complex' symbols

Message ID 20191210225921.94897-5-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series improve expansion of constant symbols | expand

Commit Message

Luc Van Oostenryck Dec. 10, 2019, 10:59 p.m. UTC
Once a symbol has its address taken, a lot of simplifications
must be avoided because the symbol can now be modified via
a pointer.

This is currently done but the symbol addressability
does not take in account the fact that a symbol can be
accessed via one of its subfields.

Add a testcase to illustrate this.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/eval/addressable-complex.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 validation/eval/addressable-complex.c
diff mbox series

Patch

diff --git a/validation/eval/addressable-complex.c b/validation/eval/addressable-complex.c
new file mode 100644
index 000000000000..62ab59f04cf9
--- /dev/null
+++ b/validation/eval/addressable-complex.c
@@ -0,0 +1,24 @@ 
+extern void def(void *);
+
+struct s1 {
+	int a;
+};
+
+int use1(void)
+{
+	struct s1 s = { 3 };
+
+	def(&s.a);
+
+	return s.a;
+}
+
+/*
+ * check-name: eval/addressable-complex
+ * check-command: test-linearize -Wno-decl -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: load\\.
+ * check-output-excludes: return\\..*\\$3
+ */