aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-13 18:43:34 -0700
committerMichael Forney <mforney@mforney.org>2021-09-13 18:43:39 -0700
commit0fb19daa48c89745b79bbf372a03c0f5be82ebe4 (patch)
tree08b6aea1c40a20d79b1bd140846022cc91eff1eb /test
parent0e9e97e37571c913864cc4d8d986fa9fda964e8a (diff)
Add test for string concatenation corner case
Diffstat (limited to 'test')
-rw-r--r--test/string-concat.c3
-rw-r--r--test/string-concat.qbe12
2 files changed, 15 insertions, 0 deletions
diff --git a/test/string-concat.c b/test/string-concat.c
new file mode 100644
index 0000000..12394ad
--- /dev/null
+++ b/test/string-concat.c
@@ -0,0 +1,3 @@
+int main(void) {
+ return "\0" "1"[0];
+}
diff --git a/test/string-concat.qbe b/test/string-concat.qbe
new file mode 100644
index 0000000..54fb1ee
--- /dev/null
+++ b/test/string-concat.qbe
@@ -0,0 +1,12 @@
+data $.Lstring.2 = align 1 { b "\0001\000", }
+export
+function w $main() {
+@start.1
+@body.2
+ %.1 =l extsw 0
+ %.2 =l mul %.1, 1
+ %.3 =l add $.Lstring.2, %.2
+ %.4 =w loadsb %.3
+ %.5 =w extsb %.4
+ ret %.5
+}