From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2D90F388E80E; Mon, 9 May 2022 13:51:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D90F388E80E From: "redbeard0531 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105534] -Wmaybe-uninitialized cases shouldn't suppress -Wuninitialized warnings Date: Mon, 09 May 2022 13:51:28 +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.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: redbeard0531 at gmail dot com X-Bugzilla-Status: NEW 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2022 13:51:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105534 --- Comment #4 from Mathias Stearn --- (In reply to Richard Biener from comment #2) > Note there's >=20 > _2 =3D value_1(D) * x_2; >=20 > where _2 might be effectively uninitialized iff x_2 is not zero. When x_2 > is zero then _2 has a well-defined value. Not according to the C++ standard. http://eel.is/c++draft/basic.indet seems pretty clear that unless x_2 is std::byte (which doesn't support multiplication) or an "unsigned ordinary character type", then that is UB.= =20 FWIW I still think I'd expect the warning on "unsigned char x, y; y =3D x *= 0;", but I would definitiely expect the warning for int.=