summaryrefslogtreecommitdiff
path: root/extra/Configs
diff options
context:
space:
mode:
authorTom Bannink <tombannink@gmail.com>2022-04-12 13:36:51 +0000
committerWaldemar Brodkorb <wbx@openadk.org>2022-04-13 14:17:48 +0200
commit592574ae535c35de500f6c3e8d8400d0bb0d985a (patch)
tree2f92bea117177e747f95567982de711fcb601eb2 /extra/Configs
parent3c34ca798156d58fdea79eef9c0c988f6c8980ff (diff)
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. Signed-off-by: Tom Bannink <tombannink@gmail.com> Acked-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'extra/Configs')
0 files changed, 0 insertions, 0 deletions