aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aarch64/Asmexpand.ml1
-rw-r--r--test/gourdinl/builtin_memcpy.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/aarch64/Asmexpand.ml b/aarch64/Asmexpand.ml
index 828c96d6..68884550 100644
--- a/aarch64/Asmexpand.ml
+++ b/aarch64/Asmexpand.ml
@@ -185,6 +185,7 @@ let memcpy_small_arg sz arg tmp =
| BA_addrstack ofs ->
if offset_in_range ofs
&& offset_in_range (Ptrofs.add ofs (Ptrofs.repr (Z.of_uint sz)))
+ && (Z.to_int ofs) mod 8 = 0
then (XSP, ofs)
else begin expand_addimm64 (RR1 tmp) XSP ofs; (RR1 tmp, _0) end
| _ ->
diff --git a/test/gourdinl/builtin_memcpy.c b/test/gourdinl/builtin_memcpy.c
new file mode 100644
index 00000000..421f543c
--- /dev/null
+++ b/test/gourdinl/builtin_memcpy.c
@@ -0,0 +1,9 @@
+struct a b;
+struct a {
+ short;
+ int;
+ short;
+} c() {
+ struct a d[2][16];
+ b = d[1][7];
+}