aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-16 12:25:00 -0700
committerMichael Forney <mforney@mforney.org>2019-04-16 12:25:00 -0700
commit953e1e6f287d8bc00b2ef8d2197a20a549274eb3 (patch)
treee8f8face3213b1a50761712441d43ac88fe0b663 /tests
parent89fb4f577655dac61e81bbebd804e8843140a305 (diff)
downloadcproc-953e1e6f287d8bc00b2ef8d2197a20a549274eb3.tar.xz
Fix offset of initializer following fixed-length string
Diffstat (limited to 'tests')
-rw-r--r--tests/initializer-string-array.c3
-rw-r--r--tests/initializer-string-array.qbe23
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/initializer-string-array.c b/tests/initializer-string-array.c
new file mode 100644
index 0000000..9ccc9d0
--- /dev/null
+++ b/tests/initializer-string-array.c
@@ -0,0 +1,3 @@
+void f(void) {
+ char x[][4] = {"abc", "xyz"};
+}
diff --git a/tests/initializer-string-array.qbe b/tests/initializer-string-array.qbe
new file mode 100644
index 0000000..87a03fd
--- /dev/null
+++ b/tests/initializer-string-array.qbe
@@ -0,0 +1,23 @@
+export
+function $f() {
+@start.1
+ %.1 =l alloc4 8
+@body.2
+ %.2 =l add %.1, 0
+ storeb 97, %.2
+ %.3 =l add %.1, 1
+ storeb 98, %.3
+ %.4 =l add %.1, 2
+ storeb 99, %.4
+ %.5 =l add %.1, 3
+ storeb 0, %.5
+ %.6 =l add %.1, 4
+ storeb 120, %.6
+ %.7 =l add %.1, 5
+ storeb 121, %.7
+ %.8 =l add %.1, 6
+ storeb 122, %.8
+ %.9 =l add %.1, 7
+ storeb 0, %.9
+ ret
+}