aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/initializer-replace.c10
-rw-r--r--tests/initializer-replace.qbe22
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/initializer-replace.c b/tests/initializer-replace.c
new file mode 100644
index 0000000..8b93ef2
--- /dev/null
+++ b/tests/initializer-replace.c
@@ -0,0 +1,10 @@
+void f(void) {
+ struct {
+ char s[6];
+ } x = {
+ .s[0] = 'x',
+ .s[4] = 'y',
+ .s = "hello",
+ .s[1] = 'a',
+ };
+}
diff --git a/tests/initializer-replace.qbe b/tests/initializer-replace.qbe
new file mode 100644
index 0000000..72ad90a
--- /dev/null
+++ b/tests/initializer-replace.qbe
@@ -0,0 +1,22 @@
+export
+function $f() {
+@start.1
+ %.1 =l alloc4 6
+@body.2
+ %.2 =l add %.1, 0
+ storeb 104, %.2
+ %.3 =l add %.1, 1
+ storeb 101, %.3
+ %.4 =l add %.1, 2
+ storeb 108, %.4
+ %.5 =l add %.1, 3
+ storeb 108, %.5
+ %.6 =l add %.1, 4
+ storeb 111, %.6
+ %.7 =l add %.1, 1
+ %.8 =w copy 97
+ storeb %.8, %.7
+ %.9 =l add %.1, 5
+ storeb 0, %.9
+ ret
+}