From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0EC7D3858D28; Tue, 29 Nov 2022 16:35:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0EC7D3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669739733; bh=WhqM7Yxz29IKP7WN+z1/TUi32owSQKtczzHMoOCmrsw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ghD5REXuXx/1rfWpPdcWZxc6XqHEOr67KwLU2vJa0T0V90nyuifp3fK+M4wu80uT0 OResgJF/9gNk8sPuWagzn+bD0ozRFOUhGmgs6cegCwZ+RDUtrkh7/tisphAzlOw/R0 O079lncBCV7ZTt/MXc8OMTQpEsFC7JS3i7onCpc4= From: "freddie_chopin at op dot pl" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107138] [12/13 regression] std::variant triggers false-positive 'may be used uninitialized' warning Date: Tue, 29 Nov 2022 16:35:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: freddie_chopin at op dot pl 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: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D107138 Freddie Chopin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |freddie_chopin at op dot pl --- Comment #8 from Marco Clemencic --- That explains it then, thanks for the info. I admit I like the idea a lot. I'm just surprised that we do get warnings f= rom the C++ standard library in some perfectly reasonable code... Now I have to decide what to do in my code. Probably I'll have to selective= ly suppress the warning, which is something I hate. But the warning is not issued in -O0 builds, which I believe means the code= is correct by itself, but I have the feeling the warning gets checked after the optimizer refactored the code taking into account invariants already checked and at that point the "maybe-uninitialized" checker gets confused. If this = is the case we can argue if it is the intended behavior or a bug in the way th= is new feature has been implemented. --- Comment #9 from Freddie Chopin --- Possibly related/duplicate #107919=