https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109339
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Richard Biener from comment #2) > The diagnostic is intentional I think. We see > > <bb 2> [local count: 1073741824]: > ss ={v} {CLOBBER}; > std::stop_token::_Stop_state_ref::_Stop_state_ref (&ss._M_state, &ss); > std::stop_source::~stop_source (&ss); > ss ={v} {CLOBBER(eol)}; > return 0; > > and the call to _Stop_state_ref passes references to uninitialized 'ss' > (tree-ssa-uninit.cc:maybe_warn_pass_by_reference). The &ss argument > is a const reference and the function does > > _Stop_state_ref(const _Stop_state_ref& __other) noexcept That function is never used in this code though. Why is code being emitted for it? We don't copy a _Stop_state_ref, we construct one using this constructor: _Stop_state_ref(const stop_source&) : _M_ptr(new _Stop_state_t()) { } This has a reference to ss but doesn't inspect it at all. > : _M_ptr(__other._M_ptr) > { > if (_M_ptr) > _M_ptr->_M_add_owner(); > } > > so it inspects __other._M_ptr. It looks like for some reason the NSDMI > init of _M_ptr isn't happening? Because an NSDMI is not used if the constructor inits it explicitly, like this one does. But this constructor is never used anyway, it's an unused inline function so should not be emitted, and we should not get warnings for it.