ref: 532456cdf90cecdbc0bc80f1e4a6d002accb3bb2
parent: b36e3b65309bdaa5515cb2d9a6313998e174e35d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Nov 13 12:24:12 EST 2021
cc1: Add 0187-zero-struct.c This test check correctness of the padding between elements of an initializer.
--- /dev/null
+++ b/tests/cc/execute/0187-zero-struct.c
@@ -1,0 +1,24 @@
+struct json_node {
+ int type;
+ char *name;
+};
+
+int
+main(void)
+{
+ struct json_node nodes[16] = { { 0 } };
+ char sentinel[] = {
+ 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98,
+ };
+ int i;
+
+ for (i = 0; i < 16; i++) {
+ if (nodes[i].name || nodes[i].type)
+ return i+1;
+ }
+
+ return 0;
+}
--- a/tests/cc/execute/scc-tests.lst
+++ b/tests/cc/execute/scc-tests.lst
@@ -177,3 +177,4 @@
0184-esc-macro.c
0185-esc-macro2.c
0186-dec-ary.c
+0187-zero-struct.c