aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/eval
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-17 01:11:52 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-17 01:11:52 +0100
commit0f49afdec53446e7af20271519ae422d8d183360 (patch)
treeadd3a0763f0bf26ea838cbe89bbb9a40285b1d12 /validation/eval
parent1e55dbed260fffac3e392ac61604f401d64980f4 (diff)
parent0d92426b4e15d7565e1a1d45cb41e06059ed2043 (diff)
downloadsparse-dev-0f49afdec53446e7af20271519ae422d8d183360.tar.gz
Merge branch 'expand-init' (early part) into next
* improve expansion of constant symbols
Diffstat (limited to 'validation/eval')
-rw-r--r--validation/eval/addressable-complex.c23
-rw-r--r--validation/eval/addressable-degen.c17
2 files changed, 40 insertions, 0 deletions
diff --git a/validation/eval/addressable-complex.c b/validation/eval/addressable-complex.c
new file mode 100644
index 00000000..e3d4aca4
--- /dev/null
+++ b/validation/eval/addressable-complex.c
@@ -0,0 +1,23 @@
+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-output-ignore
+ * check-output-contains: load\\.
+ * check-output-excludes: return\\..*\\$3
+ */
diff --git a/validation/eval/addressable-degen.c b/validation/eval/addressable-degen.c
new file mode 100644
index 00000000..d420927e
--- /dev/null
+++ b/validation/eval/addressable-degen.c
@@ -0,0 +1,17 @@
+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-output-ignore
+ * check-output-contains: load\\.
+ */