new file mode 100644
@@ -0,0 +1,16 @@
+int test_array(int i)
+{
+ static const int a[3] = { [0] = 1, [2] = 3, };
+
+ return a[1];
+}
+
+/*
+ * check-name: default-init-array
+ * check-command: test-linearize -Wno-decl -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: phisrc\\..*return.*\\$0
+ * check-output-excludes: load\\.
+ */
new file mode 100644
@@ -0,0 +1,23 @@
+struct s {
+ int a;
+ int b;
+ int c;
+};
+
+
+int test_struct(void)
+{
+ struct s s = { .a = 1, .c = 3, };
+
+ return s.b;
+}
+
+/*
+ * check-name: default-init-struct
+ * check-command: test-linearize -Wno-decl -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: phisrc\\..*return.*\\$0
+ * check-output-excludes: load\\.
+ */
Currently, constant_symbol_value() is doing the expansion of a constant initializer when an explicit one is found but nothing is done for the default/implicit ones. Add a testcase to illustrate this. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- validation/expand/default-init-array.c | 16 ++++++++++++++++ validation/expand/default-init-struct.c | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 validation/expand/default-init-array.c create mode 100644 validation/expand/default-init-struct.c