From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 60E18396D822; Wed, 16 Nov 2022 20:33:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60E18396D822 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668630834; bh=pmwelmWJuYHnRYFkd6+wbzu4WnNHDeQm71/+Mfw1Urc=; h=From:To:Subject:Date:From; b=ij8KGu5mTw+odv7fjT3V++2GRjv3C1Z5sAnwGswd120bw7qTXw7aHi0kmpTrQlrH5 N+LMPPzwGulvZj0QD9xsk6917TQwIs6GSLq5mmnXPspKOJEy5oy/DacwaFyC2gYqnE ogbmsol8XWQCtFLtstXIr2GjUMAUMRynOCBfVa1c= From: "cuzdav at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/107725] New: Spurious warning: use of uninitialized value with std::any Date: Wed, 16 Nov 2022 20:33:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cuzdav at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm 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 attachments.created 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=3D107725 Bug ID: 107725 Summary: Spurious warning: use of uninitialized value with std::any Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: cuzdav at gmail dot com Target Milestone: --- Created attachment 53914 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53914&action=3Dedit preprocessed code With the analyzer (-fanalyzer), this built cleanly with GCC10 and GCC11, but starting with GCC 12 (still occurring in trunk) in either C++17 or c++20 mo= de, I see this warning (x86 linux): :4:13: warning: use of uninitialized value '' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 4 | return {}; | ^ 'std::any create()': events 1-2 | | 3 | std::any create() { | | ^ | | | | | (1) region created on stack here | 4 | return {}; | | ~=20=20=20=20 | | | | | (2) use of uninitialized value '' here | Compiler returned: 0 This is the code in its entirety: #include std::any create() { return {}; } https://godbolt.org/z/TWPcaW4Kn=