I see this issue with latest master using Clang 17.0.6 on aarch64, and running the functional tests under Valgrind (3.22.0):
0 node0 stderr ==75935== Thread 25 b-msghand:
1==75935== Conditional jump or move depends on uninitialised value(s)
2==75935== at 0x1955B8: _M_reset (optional:313)
3==75935== by 0x1955B8: ~_Optional_payload (optional:437)
4==75935== by 0x1955B8: ~_Optional_base (optional:508)
5==75935== by 0x1955B8: GetLocalAddress(CNode const&) (???:220)
6==75935== by 0x1956A3: GetLocalAddrForPeer(CNode&) (net.cpp:240)
7==75935== by 0x1D091F: MaybeSendAddr (net_processing.cpp:5259)
8==75935== by 0x1D091F: (anonymous namespace)::PeerManagerImpl::SendMessages(CNode*) (???:5453)
9==75935== by 0x1AA183: CConnman::ThreadMessageHandler() (net.cpp:2886)
10==75935== by 0x750627: operator() (std_function.h:591)
11==75935== by 0x750627: util::TraceThread(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>) (???:21)
12==75935== by 0x1B290F: __invoke_impl<void, void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)> (invoke.h:61)
13==75935== by 0x1B290F: __invoke<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)> (invoke.h:96)
14==75935== by 0x1B290F: _M_invoke<0UL, 1UL, 2UL> (std_thread.h:292)
15==75935== by 0x1B290F: operator() (std_thread.h:299)
16==75935== by 0x1B290F: std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, CConnman::Start(CScheduler&, CConnman::Options const&)::$_5> > >::_M_run() (std_thread.h:244)
17==75935== by 0x4C501BF: execute_native_thread_routine (thread.cc:104)
18==75935== by 0x4F85E37: start_thread (pthread_create.c:447)
19==75935== by 0x4FF0E5B: thread_start (clone.S:79)
20==75935==
21{
22 <insert_a_suppression_name_here>
23 Memcheck:Cond
24 fun:_M_reset
25 fun:~_Optional_payload
26 fun:~_Optional_base
27 fun:_Z15GetLocalAddressRK5CNode
28 fun:_Z19GetLocalAddrForPeerR5CNode
29 fun:MaybeSendAddr
30 fun:_ZN12_GLOBAL__N_115PeerManagerImpl12SendMessagesEP5CNode
31 fun:_ZN8CConnman20ThreadMessageHandlerEv
32 fun:operator()
33 fun:_ZN4util11TraceThreadESt17basic_string_viewIcSt11char_traitsIcEESt8functionIFvvEE
34 fun:__invoke_impl<void, void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)>
35 fun:__invoke<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), const char *, (lambda at net.cpp:3231:71)>
36 fun:_M_invoke<0UL, 1UL, 2UL>
37 fun:operator()
38 fun:_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvSt17basic_string_viewIcSt11char_traitsIcEESt8functionIFvvEEEPKcZN8CConnman5StartER10CSchedulerRKNSE_7OptionsEE3$_5EEEEE6_M_runEv
39 fun:execute_native_thread_routine
40 fun:start_thread
41 fun:thread_start
42}
43==75935==
44==75935== Exit program on first error (--exit-on-first-error=yes)
Bisected to #28078 being the cause.