From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 389D0396D80E; Wed, 16 Nov 2022 20:40:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 389D0396D80E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668631216; bh=4ZqUPFq2DUh1w74NUOVFyaeRUdeVYO+Tl3zb1hk/XCA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wYIJZdbIENgHyZqUZm0nr4peQNCfz/ZS5n03RckAMWFAoqYWhwL/aqPwHvcKAPzLr CI0YrTXVVwG99FBeqju+Uy7z4wHkPlcR3PgW4vNnF85xzsM+N+jaxlC3D9Ec27YH/r Gb01mEzaT77qSpghP0TN5tbd/jp0gfPhu8yAzUZE= From: "cuzdav at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/107725] Spurious warning: use of uninitialized value with std::any Date: Wed, 16 Nov 2022 20:40:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: 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=3D107725 --- Comment #1 from Chris Uzdavinis --- I get a similar warning with this code. Unsure if it's the same underlying issue. Also does not warn with g++10 or g++11, but does with newer version= s. #include #include std::string create() { std::ostringstream oss; return oss.str(); } https://godbolt.org/z/cz66zhKn5 :6:20: warning: use of uninitialized value '' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 6 | return oss.str(); | ^ 'std::string create()': events 1-2 | | 4 | std::string create() { | | ^ | | | | | (1) region created on stack here | 5 | std::ostringstream oss; | 6 | return oss.str(); | | ~ | | | | | (2) use of uninitialized value '' = here=