From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ECF963858D32; Sat, 8 Apr 2023 22:09:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECF963858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680991792; bh=wt6ZpVsLsGsPlJNmV7AormE+OeMmAWxDBS5YJmPgHTw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=utIT1eeetX0yLBG92hO5HdYMxpQxkrDlosFo3qL4DTANwc7g13ZVbHLFpM5CMTVkx m6tRD/HVhRpxIZa+Q9htOdcVIu6mQXJ+429Ywq2SxBOg7iTt6L20sHn4velqJx84su rSkVYl4cBpWoDWCRfIaDQWsbn6WbIuCgMN+bSDG4= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109448] [12/13 Regression] wrong uninitialized warning with std::variant of an empty class and std::exception_ptr Date: Sat, 08 Apr 2023 22:09:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: diagnostic, needs-reduction X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: short_desc target_milestone cf_known_to_fail cf_known_to_work 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=3D109448 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|_M_exception_object=E2=80=99 may be |[12/13 Regression]= wrong |used uninitialized |uninitialized warning with |[-Werror=3Dmaybe-uninitialize |std::variant of an empty |d] |class and | |std::exception_ptr Target Milestone|--- |12.3 Known to fail| |12.1.0 Known to work| |11.3.0 --- Comment #2 from Andrew Pinski --- Reduced further: ``` #include #include #include #include struct Empty {}; struct Try { Try() =3D default; ~Try() =3D default; Try(Empty a): _value(a){} Try(Try&& other) =3D default; Try& operator=3D(Try&& other) =3D default; std::variant _value; }; struct TestPromise { void setResult(Try&& value) { if(_state !=3D 0) __builtin_abort(); _try_value =3D std::move(value); } std::atomic _state =3D 0; Try _try_value; }; int main() { TestPromise promise; promise.setResult(Empty()); } ```=