aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-01-21 22:48:53 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-09-26 18:10:29 +0200
commit7a3cc9608ed2531f7fa0b6704c27bdddaa5053b7 (patch)
treeaedd511be5052bb3629e2bfea3527e875cee75cf
parent686de6f296f2720e5667bd93b867a8342ad59ed1 (diff)
downloadsparse-7a3cc9608ed2531f7fa0b6704c27bdddaa5053b7.tar.gz
expand: add test for expansion of compound literals
Compound literals are currently not expanded. Add a test for this. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--validation/expand/compound-literal.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/validation/expand/compound-literal.c b/validation/expand/compound-literal.c
new file mode 100644
index 00000000..7401b019
--- /dev/null
+++ b/validation/expand/compound-literal.c
@@ -0,0 +1,27 @@
+#define SAME_TYPE(A, B) \
+ __builtin_types_compatible_p(A, B)
+
+struct s {
+ int i;
+};
+
+static void foo(struct s *p)
+{
+ *p = (struct s) { .i = SAME_TYPE(int, int), };
+}
+
+/*
+ * check-name: compound-literal
+ * check-command: test-linearize $file
+ * check-known-to-fail
+ *
+ * check-output-start
+foo:
+.L0:
+ <entry-point>
+ store.32 $1 -> 0[%arg1]
+ ret
+
+
+ * check-output-end
+ */