From 0fb19daa48c89745b79bbf372a03c0f5be82ebe4 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 13 Sep 2021 18:43:34 -0700 Subject: Add test for string concatenation corner case --- test/string-concat.c | 3 +++ test/string-concat.qbe | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/string-concat.c create mode 100644 test/string-concat.qbe 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 +} -- cgit v1.2.3