diff --git a/include/boost/corosio/native/detail/io_uring/io_uring_scheduler.hpp b/include/boost/corosio/native/detail/io_uring/io_uring_scheduler.hpp index e00a405d7..31f15b9c5 100644 --- a/include/boost/corosio/native/detail/io_uring/io_uring_scheduler.hpp +++ b/include/boost/corosio/native/detail/io_uring/io_uring_scheduler.hpp @@ -636,7 +636,12 @@ io_uring_scheduler::post(std::coroutine_handle<> h) const { auto saved = h_; delete this; + // TSan cannot instrument standalone fences; this acquire + // pairs with the posting thread's release and is intentional. + BOOST_COROSIO_GCC_WARNING_PUSH + BOOST_COROSIO_GCC_WARNING_DISABLE("-Wtsan") std::atomic_thread_fence(std::memory_order_acquire); + BOOST_COROSIO_GCC_WARNING_POP saved.resume(); } diff --git a/include/boost/corosio/native/detail/reactor/reactor_scheduler.hpp b/include/boost/corosio/native/detail/reactor/reactor_scheduler.hpp index 7be901417..1a46974a5 100644 --- a/include/boost/corosio/native/detail/reactor/reactor_scheduler.hpp +++ b/include/boost/corosio/native/detail/reactor/reactor_scheduler.hpp @@ -490,8 +490,13 @@ reactor_scheduler::post(std::coroutine_handle<> h) const { auto saved = h_; delete this; - // Ensure stores from the posting thread are visible + // Ensure stores from the posting thread are visible. TSan + // cannot instrument standalone fences; this acquire pairs + // with the posting thread's release and is intentional. + BOOST_COROSIO_GCC_WARNING_PUSH + BOOST_COROSIO_GCC_WARNING_DISABLE("-Wtsan") std::atomic_thread_fence(std::memory_order_acquire); + BOOST_COROSIO_GCC_WARNING_POP saved.resume(); } diff --git a/test/unit/Jamfile b/test/unit/Jamfile index f6fc0d435..97ed8439c 100644 --- a/test/unit/Jamfile +++ b/test/unit/Jamfile @@ -21,6 +21,12 @@ project boost/corosio/test/unit windows:_WIN32_WINNT=0x0602 extra on + # GCC mis-analyzes the structured-binding-from-co_await idiom + # (auto [ec, ...] = co_await op) in coroutine frames and reports a + # bogus -Wmaybe-uninitialized. The pattern is unavoidable and used by + # most async tests, so suppress it for GCC across the test project. + # (The library itself is clean; see capy test/unit/Jamfile.) + gcc:-Wno-maybe-uninitialized ; # Non-TLS tests (recurses into test/, native/, etc.)