>>>> "tombannink" == tombannink
<tombannink(a)gmail.com> writes:
Good catch, thanks Peter.
From 880ae1a543f6518f37a32b3af5a734a7b72f9b39 Mon Sep 17 00:00:00 2001
From: Tom Bannink <tombannink(a)gmail.com>
Date: Tue, 12 Apr 2022 11:15:41 +0200
Subject: [PATCH] Fix bug in ARM memset implementation
The ARM implementation of memset has a bug when the
fill-value is negative or outside the
[0, 255] range. To reproduce:
char array[256];
memset(array, -5, 256);
This is supposed to fill the array with int8 values
-5, -5, -5, ... . On ARM, this does
not work because the implementation assumes the high bytes of the fill-value argument
are
already zero. However in this test case they are filled with 1-bits. The aarch64 and
x86_64
implementations do not have this problem: they first convert the fill-value to an
unsigned
byte following the specification of memset.
With GCC one can use `memset(ptr, (-5 & 0xFF),
size)` as a workaround, but for clang
users that does not work: clang optimizes the `& 0xFF` away because it assumes that
memset will do it.
Acked-by: Peter Korsgaard <peter(a)korsgaard.com>
--
Bye, Peter Korsgaard