Created attachment 147840 [details] output of "valgrind -v ./a.out" SUMMARY wmemcmp(s1, s2, n) gives false positive even if n is smaller than the allocated size of s1 and s2 STEPS TO REPRODUCE 1. compile the following C source (test.c): #include <stdlib.h> #include <wchar.h> int main() { wchar_t *a, *b; int ret; a = (wchar_t*)calloc(3, sizeof(wchar_t)); b = (wchar_t*)calloc(3, sizeof(wchar_t)); ret = wmemcmp(a, b, 2); free(a); free(b); return ret; } 2. valgrind ./a.out OBSERVED RESULT Invalid read of size 32 at 0x49EB499: __wmemcmp_avx2_movbe (memcmp-avx2-movbe.S:412) by 0x40118B: main (test.c:8) Address 0x4a75090 is 0 bytes inside a block of size 12 alloc'd at 0x4849464: calloc (vg_replace_malloc.c:1328) by 0x40116F: main (test.c:7) Output of 'valglind -v ./a.out' is in log.txt. EXPECTED RESULT no error SOFTWARE/OS VERSIONS Fedora-35 ADDITIONAL INFORMATION CPU is x86_64 with AVX2. Fedora-35 uses glibc-2.34. Same problem in the latest Arch Linux (glibc-2.35), but no problem in Fedora-34 (glibc-2.33).
*** This bug has been marked as a duplicate of bug 397083 ***