asio icon indicating copy to clipboard operation
asio copied to clipboard

Potential null pointer dereference

Open Wiktor-99 opened this issue 10 months ago • 1 comments

While compiling with GCC 14 (with -O2), the following line generates a -Werror=null-dereference warning, which seems to be a false positive. https://github.com/chriskohlhoff/asio/blob/4730c543ba2b8f9396ef1964a25ccc26eb1aea64/asio/include/asio/io_context.hpp#L826

GCC output:

118.1 In function ‘bool asio::operator==(const io_context::basic_executor_type<std::allocator<void>, 0>&, const io_context::basic_executor_type<std::allocator<void>, 0>&)’,
118.1     inlined from ‘static bool asio::execution::detail::any_executor_base::equal_ex(const asio::execution::detail::any_executor_base&, const asio::execution::detail::any_executor_base&) [with Ex = asio::io_context::basic_executor_type<std::allocator<void>, 0>]’ at /3rdparty/asio/include/asio/execution/any_executor.hpp:891:16:
118.1 /3rdparty/asio/include/asio/io_context.hpp:815:27: error: potential null pointer dereference [-Werror=null-dereference]
118.1   815 |     return a.target_ == b.target_

Wiktor-99 avatar Apr 07 '25 10:04 Wiktor-99