From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5F9713858436; Wed, 29 Mar 2023 19:43:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F9713858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680119024; bh=sZYpUTaXG7HCBHMUfO7WkyualRPXevBoNT0N1fkk5Vg=; h=From:To:Subject:Date:From; b=oMQg8MabDTlAdsmUW6rqkkZb6G7SVVS3Z6qDhnLwDuwQdtXXwe7Xyo+/6qMvP9Tbb 8FXrQ2HhEQ2XwzPKXgfCU7av1FMZ21NRAP8eV4RpspFw0DgkgZ39+rxXMaUq+I2E+i JCgB8TnRFp/sCaEJwSIcH00JzG67hr/nBG0O1SdI= From: "gcc at heine dot tech" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109339] New: stop_token compiled with -Og yields maybe-uninitialized Date: Wed, 29 Mar 2023 19:43:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gcc at heine dot tech X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 Bug ID: 109339 Summary: stop_token compiled with -Og yields maybe-uninitialized Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at heine dot tech Target Milestone: --- This happens since gcc 12. This snippet compiled with -std=3Dc++20 -Og -Wmaybe-uninitialized ``` #include int main() { std::stop_source ss; } ``` yields this warning ``` In constructor 'std::stop_source::stop_source()', inlined from 'int main()' at :4:22: /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/stop_token:480:21: warning: 'ss' may be used uninitialized [-Wmaybe-uninitialized] 480 | stop_source() : _M_state(*this) | ^~~~~~~~~~~~~~~ /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/stop_token: In function 'int main()': /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/stop_token:397:7: note= : by argument 2 of type 'const std::stop_source&' to 'std::stop_token::_Stop_state_ref::_Stop_state_ref(const std::stop_source&)' declared here 397 | _Stop_state_ref(const stop_source&) | ^~~~~~~~~~~~~~~ :4:22: note: 'ss' declared here 4 | std::stop_source ss; | ^~ ``` Godbolt: https://godbolt.org/z/KofErdEzY=