From 63f5a80b7146cfe7b9034be683b4a8dfc29a1a25 Mon Sep 17 00:00:00 2001 From: dweiller <4678790+dweiller@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:45:12 +1100 Subject: [PATCH] compiler-rt: workaround miscompilation in memmove --- lib/compiler_rt/memmove.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/compiler_rt/memmove.zig b/lib/compiler_rt/memmove.zig index 081d47ad59..0fa5ed1ce7 100644 --- a/lib/compiler_rt/memmove.zig +++ b/lib/compiler_rt/memmove.zig @@ -137,7 +137,8 @@ inline fn copyRange4( const d2 = src[pen..][0..copy_len].*; const d3 = src[last..][0..copy_len].*; - dest[0..copy_len].* = d0; + // the slice dest[0..len] is needed to workaround -ODebug miscompilation + dest[0..len][0..copy_len].* = d0; dest[b..][0..copy_len].* = d1; dest[pen..][0..copy_len].* = d2; dest[last..][0..copy_len].* = d3;