https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93058

--- Comment #1 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Th important bits seems to be:
    gcc/testsuite/g++.dg/asan/asan_test.cc:129:22: error: writing 1 byte into a
region of size 0 [-Werror=stringop-overflow=]

I think it happens because glibc marks pvalloc() as malloc()-like function.
Test explicitly assumes that granularity is page-wide:

            char *a = (char*)pvalloc(kPageSize + 100);
            EXPECT_EQ(0U, (uintptr_t)a % kPageSize);
  /* 129 */ a[kPageSize + 101] = 1;  // we should not report an error here.
            free(a);

As build fails due to -Werror what would be a reasonable fix here?

I tested adding -Wno-stringop-overflow as and it seems to work:

$ git diff -U0 | cat
diff --git a/gcc/testsuite/g++.dg/asan/asan_test.C
b/gcc/testsuite/g++.dg/asan/asan_test.C
index f3f7626ef3b..8e18744c7c6 100644
--- a/gcc/testsuite/g++.dg/asan/asan_test.C
+++ b/gcc/testsuite/g++.dg/asan/asan_test.C
@@ -5 +5 @@
-// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror -g
-DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0
-DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }
+// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror
-Wno-stringop-overflow -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1
-DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }

Reply via email to