From b1da339b3e57fe8fdf5dc2a3c0cb30fb2ea993c2 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 1 Dec 2021 08:12:46 +0000 Subject: [PATCH] build fix proposal for GCC 11.x (spotted with 11.2.0). build error due to access none attribute on the pthread_setspecific's value argumenti (glibc). --- src/mem/threadalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mem/threadalloc.h b/src/mem/threadalloc.h index 4f6b674..c7d23f1 100644 --- a/src/mem/threadalloc.h +++ b/src/mem/threadalloc.h @@ -71,7 +71,6 @@ namespace snmalloc # pragma warning(pop) # endif #else - /** * Holds the thread local state for the allocator. The state is constant * initialised, and has no direct dectructor. Instead snmalloc will call @@ -137,7 +136,8 @@ namespace snmalloc Singleton p_key; // We need to set a non-null value, so that the destructor is called, // we never look at the value. - pthread_setspecific(p_key.get(), reinterpret_cast(1)); + static char p_teardown_val = 1; + pthread_setspecific(p_key.get(), &p_teardown_val); # ifdef SNMALLOC_TRACING std::cout << "Using pthread clean up" << std::endl; # endif