Bug 397083 - Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and __wmemcmp_avx2_movbe

This commit is contained in:
Paul Floyd 2023-04-20 22:11:31 +02:00
parent e1684bc775
commit a2af9adec4
7 changed files with 44 additions and 0 deletions

1
.gitignore vendored
View File

@ -1004,6 +1004,7 @@
/memcheck/tests/wcs
/memcheck/tests/weirdioctl
/memcheck/tests/with space
/memcheck/tests/wmemcmp
/memcheck/tests/wrap1
/memcheck/tests/wrap2
/memcheck/tests/wrap3

1
NEWS
View File

@ -126,6 +126,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
351857 confusing error message about valid command line option
374596 inconsistent RDTSCP support on x86_64
392331 Spurious lock not held error from inside pthread_cond_timedwait
397083 Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and __wmemcmp_avx2_movbe
400793 pthread_rwlock_timedwrlock false positive
419054 Unhandled syscall getcpu on arm32
433873 openat2 syscall unimplemented on Linux

View File

@ -376,6 +376,7 @@ EXTRA_DIST = \
vcpu_fnfns.stdout.exp-darwin vcpu_fnfns.stdout.exp-solaris \
vcpu_fnfns.stderr.exp vcpu_fnfns.vgtest \
wcs.vgtest wcs.stderr.exp wcs.stdout.exp \
wmemcmp.vgtest wmemcmp.stderr.exp \
wrap1.vgtest wrap1.stdout.exp wrap1.stderr.exp \
wrap2.vgtest wrap2.stdout.exp wrap2.stderr.exp \
wrap3.vgtest wrap3.stdout.exp wrap3.stderr.exp \
@ -478,6 +479,7 @@ check_PROGRAMS = \
vcpu_fbench vcpu_fnfns \
wcs \
xml1 \
wmemcmp \
wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \
wrapmalloc wrapmallocso.so wrapmallocstatic \
writev1

17
memcheck/tests/wmemcmp.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdlib.h>
#include <wchar.h>
int main ()
{
wchar_t *s = (wchar_t *) malloc (8 * sizeof (wchar_t));
s[0] = '-';
s[1] = 'N';
s[2] = 'A';
s[3] = 'N';
s[4] = ' ';
s[5] = '3';
s[6] = '3';
s[7] = '\0';
return wmemcmp (s + 1, L"NAN", 3) == 0;
}

View File

View File

@ -0,0 +1,2 @@
prog: wmemcmp
vgopts: -q

View File

@ -104,6 +104,7 @@
20440 WCSNLEN
20450 WSTRNCMP
20460 MEMMEM
20470 WMEMCMP
*/
#if defined(VGO_solaris)
@ -2262,6 +2263,26 @@ static inline void my_exit ( int x )
#if defined(VGO_freebsd)
WMEMCHR(VG_Z_LIBC_SONAME, wmemchr)
#endif
#define WMEMCMP(soname, fnname) \
int VG_REPLACE_FUNCTION_EZU(20470,soname,fnname) \
( const Int *b1, const Int *b2, SizeT n ); \
int VG_REPLACE_FUNCTION_EZU(20470,soname,fnname) \
( const Int *b1, const Int *b2, SizeT n ) \
{ \
for (SizeT i = 0U; i < n; ++i) { \
if (b1[i] != b2[i]) \
return b1[i] > b2[i] ? 1 : -1; \
} \
return 0; \
}
#if defined(VGO_linux)
WMEMCMP(VG_Z_LIBC_SONAME, wmemcmp)
#endif
/*------------------------------------------------------------*/
/*--- Improve definedness checking of process environment ---*/
/*------------------------------------------------------------*/