From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 905933857805; Wed, 6 Apr 2022 12:12:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 905933857805 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105164] new warning in clang, missing in gcc: -Wbitwise-instead-of-logical Date: Wed, 06 Apr 2022 12:12:12 +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.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: marxin at gcc dot gnu.org 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: assigned_to bug_status 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: Wed, 06 Apr 2022 12:12:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105164 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|marxin at gcc dot gnu.org |unassigned at gcc d= ot gnu.org Status|ASSIGNED |NEW --- Comment #3 from Martin Li=C5=A1ka --- Well, I doubt the warning is much useful. There are situations where we can't use short-circuit evaluation: gcc/c-family/c-attribs.cc:2384: else if (TREE_CODE (decl) =3D=3D FUNCTION_DECL && (((curalign =3D DECL_ALIGN (decl)) > bitalign) | ((lastalign =3D DECL_ALIGN (last_decl)) > bitalign))) or we want to quickly and flags of a struct: gcc_checking_assert (!IDENTIFIER_KIND_BIT_2 (id) & !IDENTIFIER_KIND_BIT_1 (id) & !IDENTIFIER_KIND_BIT_0 (id)); Note a different code is generated for situations like: return foo() && bar() && baz (); and return foo() & bar() & baz (); So I don't think we should change the code based on the warnings.=