]> sourceware.org Git - valgrind.git/commitdiff
Bug 397083 - Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and...
authorPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 20 Apr 2023 20:11:31 +0000 (22:11 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 20 Apr 2023 20:11:31 +0000 (22:11 +0200)
.gitignore
NEWS
memcheck/tests/Makefile.am
memcheck/tests/wmemcmp.c [new file with mode: 0644]
memcheck/tests/wmemcmp.stderr.exp [new file with mode: 0644]
memcheck/tests/wmemcmp.vgtest [new file with mode: 0644]
shared/vg_replace_strmem.c

index 6622e7c59e75e2e9479dc798bd11d924d2b4c2d9..9e26e2fbf545029c0af895de0d7d2fe16aee0759 100644 (file)
 /memcheck/tests/wcs
 /memcheck/tests/weirdioctl
 /memcheck/tests/with space
+/memcheck/tests/wmemcmp
 /memcheck/tests/wrap1
 /memcheck/tests/wrap2
 /memcheck/tests/wrap3
diff --git a/NEWS b/NEWS
index 4ba0c317095b7901cb273a788586ec608be79b1c..57e39f42a3a298fad08ec980da47c02f36572bf0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
index b4d80f837a09f5a2c37a8b246da40f754173f739..faf9130bcd18b127e2e293ac1ec08dc970a1cd6c 100644 (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
diff --git a/memcheck/tests/wmemcmp.c b/memcheck/tests/wmemcmp.c
new file mode 100644 (file)
index 0000000..d737620
--- /dev/null
@@ -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;
+}
+
diff --git a/memcheck/tests/wmemcmp.stderr.exp b/memcheck/tests/wmemcmp.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/memcheck/tests/wmemcmp.vgtest b/memcheck/tests/wmemcmp.vgtest
new file mode 100644 (file)
index 0000000..637a233
--- /dev/null
@@ -0,0 +1,2 @@
+prog: wmemcmp
+vgopts: -q
index 30065d537a81f3d03b04210881935975009adff1..b32f13f76d54cd480093cdc64a6bebdfbaead4dc 100644 (file)
    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  ---*/
 /*------------------------------------------------------------*/
This page took 0.042877 seconds and 5 git commands to generate.