From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A97053858C52; Fri, 3 Feb 2023 22:02:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A97053858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675461749; bh=iO5PSTfpmDcBItptNeZo19EISz0x0tAdyCGFE+kSd6E=; h=From:To:Subject:Date:From; b=AJ/nDGcGB9WrdwWkzMSXqzrPu0FrnCpfD3MQzkVcR0GycO4cKWAqjapbEp7p0aR1a zlE0TJ6P6aXGnZkiVMn0vJBo8e0GIu0gNWqgI6R6FPNYLGazGhyxHkuy33/EyU1Hgt Qp9z7/yG6S8w26TWlYn/WSr7S9B9AYmkDTHTY79c= From: "alvaro.begue at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108667] New: Spurious "maybe used uninitialized [-Wmaybe-uninitialized]" warning Date: Fri, 03 Feb 2023 22:02:29 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: alvaro.begue at gmail dot com 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=3D108667 Bug ID: 108667 Summary: Spurious "maybe used uninitialized [-Wmaybe-uninitialized]" warning Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: alvaro.begue at gmail dot com Target Milestone: --- I am using g++-12.1.0 on x86-64, but g++-12.2.0 in godbolt.org shows the sa= me problem The options are -O3 -Wmaybe-uninitialized . The code: #include struct S { S(std::function f) : f(f) {} std::function g; std::function f; }; int main() { S s([](){}); s.f(); } Compiler output (from godbolt.org): In file included from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/functional:59, from :1: In copy constructor 'std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res =3D void; _ArgTypes =3D {}]= ', inlined from 'S::S(std::function)' at :4:34, inlined from 'int main()' at :11:15: /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/std_function.h:39= 1:17: warning: '' may be used uninitialized [-Wmaybe-uninitialized] 391 | __x._M_manager(_M_functor, __x._M_functor, __clone_functor); | ~~~~^~~~~~~~~~ /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/std_function.h: In function 'int main()': /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/std_function.h:26= 7:7: note: by argument 2 of type 'const std::_Any_data&' to 'static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res =3D void; _Functor =3D main()::; _ArgTypes =3D {}]' declared here 267 | _M_manager(_Any_data& __dest, const _Any_data& __source, | ^~~~~~~~~~ :11:15: note: '' declared here 11 | S s([](){}); | ^ Compiler returned: 0=