aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-03-22 01:58:22 -0700
committerMichael Forney <mforney@mforney.org>2022-03-22 01:58:31 -0700
commitd1cdd0839b4ef436dc8f43043d242bd49ecb28c6 (patch)
tree264e90ffe87a2dbebb44c945b0272c4f8136bf0c /test
parent2c0de069da49d84c6b03eb6a8519deeaedc598e8 (diff)
init: Allow empty initializers
Diffstat (limited to 'test')
-rw-r--r--test/initializer-empty-struct.c5
-rw-r--r--test/initializer-empty-struct.qbe8
-rw-r--r--test/initializer-empty.c4
-rw-r--r--test/initializer-empty.qbe8
4 files changed, 25 insertions, 0 deletions
diff --git a/test/initializer-empty-struct.c b/test/initializer-empty-struct.c
new file mode 100644
index 0000000..01538f5
--- /dev/null
+++ b/test/initializer-empty-struct.c
@@ -0,0 +1,5 @@
+struct s {float x; long y;};
+struct s s = {};
+void f(void) {
+ struct s t = {};
+}
diff --git a/test/initializer-empty-struct.qbe b/test/initializer-empty-struct.qbe
new file mode 100644
index 0000000..9bbfb34
--- /dev/null
+++ b/test/initializer-empty-struct.qbe
@@ -0,0 +1,8 @@
+export data $s = align 8 { z 16 }
+export
+function $f() {
+@start.1
+ %.1 =l alloc8 16
+@body.2
+ ret
+}
diff --git a/test/initializer-empty.c b/test/initializer-empty.c
new file mode 100644
index 0000000..e3e444c
--- /dev/null
+++ b/test/initializer-empty.c
@@ -0,0 +1,4 @@
+int x = {};
+void f(void) {
+ int y = {};
+}
diff --git a/test/initializer-empty.qbe b/test/initializer-empty.qbe
new file mode 100644
index 0000000..2ed8249
--- /dev/null
+++ b/test/initializer-empty.qbe
@@ -0,0 +1,8 @@
+export data $x = align 4 { z 4 }
+export
+function $f() {
+@start.1
+ %.1 =l alloc4 4
+@body.2
+ ret
+}