From 34a4e7e1025204eb7a796263d549366f84e9f667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Thu, 11 Aug 2022 12:39:30 +0300 Subject: [PATCH] mdbx: avoid Valgrind warnings. --- src/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core.c b/src/core.c index 0093005e..3ae6a62b 100644 --- a/src/core.c +++ b/src/core.c @@ -6016,7 +6016,8 @@ scan4seq_sse2(pgno_t *range, const size_t len, const unsigned seq) { * Поэтому проверяем смещение на странице, а с ASAN всегда страхуемся. */ #ifndef __SANITIZE_ADDRESS__ const unsigned on_page_safe_mask = 0xff0 /* enough for '-15' bytes offset */; - if (likely(on_page_safe_mask & (uintptr_t)(range + offset))) { + if (likely(on_page_safe_mask & (uintptr_t)(range + offset)) && + !RUNNING_ON_VALGRIND) { const unsigned extra = (unsigned)(detent + 4 - range); assert(extra > 0 && extra < 4); mask = 0xF << extra; @@ -6077,7 +6078,8 @@ scan4seq_avx2(pgno_t *range, const size_t len, const unsigned seq) { * Поэтому проверяем смещение на странице, а с ASAN всегда страхуемся. */ #ifndef __SANITIZE_ADDRESS__ const unsigned on_page_safe_mask = 0xfe0 /* enough for '-31' bytes offset */; - if (likely(on_page_safe_mask & (uintptr_t)(range + offset))) { + if (likely(on_page_safe_mask & (uintptr_t)(range + offset)) && + !RUNNING_ON_VALGRIND) { const unsigned extra = (unsigned)(detent + 8 - range); assert(extra > 0 && extra < 8); mask = 0xFF << extra; @@ -6144,7 +6146,8 @@ scan4seq_avx512bw(pgno_t *range, const size_t len, const unsigned seq) { * Поэтому проверяем смещение на странице, а с ASAN всегда страхуемся. */ #ifndef __SANITIZE_ADDRESS__ const unsigned on_page_safe_mask = 0xfc0 /* enough for '-63' bytes offset */; - if (likely(on_page_safe_mask & (uintptr_t)(range + offset))) { + if (likely(on_page_safe_mask & (uintptr_t)(range + offset)) && + !RUNNING_ON_VALGRIND) { const unsigned extra = (unsigned)(detent + 16 - range); assert(extra > 0 && extra < 16); mask = 0xFFFF << extra;