From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A4A313858C33; Fri, 31 Mar 2023 09:58:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4A313858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680256700; bh=INsdLUb0KSW6SkIg82bD7dwi0nycxLnLTJXl0oacT4c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P3/ifgQSW6Elj8IwVV0phw1f2WMTNRQ8vDUT2R6Dv+OL7FXESvPUfCyuCbXVoMh4N 5mO7GpConHPTa5t/JZ5fFZidvLnYzA6OoWpzdgDbe9sKRcwDodYWcwXaOEhfh+CAYF w1Vg9/BkEzimlrTaJEtDtsl3CO5Qa/Q2gbnJrWuA= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109339] [12/13 Regression] stop_token compiled with -Og yields maybe-uninitialized Date: Fri, 31 Mar 2023 09:58:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109339 --- Comment #5 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #4) > (In reply to Richard Biener from comment #2) > > The diagnostic is intentional I think. We see > >=20 > > [local count: 1073741824]: > > ss =3D{v} {CLOBBER}; > > std::stop_token::_Stop_state_ref::_Stop_state_ref (&ss._M_state, &ss); > > std::stop_source::~stop_source (&ss); > > ss =3D{v} {CLOBBER(eol)}; > > return 0; > >=20 > > 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 > >=20 > > _Stop_state_ref(const _Stop_state_ref& __other) noexcept >=20 > That function is never used in this code though. Why is code being emitted > for it? Actually I don't think any code is being emitted for it, so that's fine. Th= at function is a red herring, but not involved here at all. The warning is for this one: > We don't copy a _Stop_state_ref, we construct one using this constructor: >=20 > _Stop_state_ref(const stop_source&) > : _M_ptr(new _Stop_state_t()) > { } >=20 > This has a reference to ss but doesn't inspect it at all. It can't inspect it, because it's not even named. The function has no way to possibly access the uninitialized object through that reference.=