From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 85CFA3858C53; Tue, 5 Apr 2022 21:24:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85CFA3858C53 From: "dcb314 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105164] new warning in clang, missing in gcc: -Wbitwise-instead-of-logical Date: Tue, 05 Apr 2022 21:24:02 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: dcb314 at hotmail dot com 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: --- 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: Tue, 05 Apr 2022 21:24:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105164 --- Comment #1 from David Binderman --- Interestingly, I tried a build of gcc trunk with the new clang-14 and got many cases of this warning. $ grep "warning:.*Wbitwise-instead-of-logical" mk.out | sort | uniq -c > /t= mp/0 $ wc -l /tmp/0 16 /tmp/0 $ cat /tmp/0 1 :184:13: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/c-family/c-attribs.cc:2384:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/cp/decl.cc:11850:7: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] 2 ../../trunk.git/gcc/cp/lex.cc:124:24: warning: use of bitwise '&' w= ith boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/cp/lex.cc:571:11: warning: use of bitwise '&' w= ith boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/cp/module.cc:16843:11: warning: use of bitwise = '&' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/cp/name-lookup.cc:7528:12: warning: use of bitw= ise '&' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/cp/parser.cc:883:11: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] 51 ../../trunk.git/gcc/function-abi.h:177:13: warning: use of bitwise = '&' with boolean operands [-Wbitwise-instead-of-logical] 49 ../../trunk.git/gcc/function-abi.h:184:13: warning: use of bitwise = '&' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/function-abi.h../../trunk.git/gcc/loop-unroll.cc::18417= 50::1319:: warning: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]array index 1 is past the end of the array (w= hich contains 1 element) [-Warray-bounds] 1 ../../trunk.git/gcc/gimple-ssa-sprintf.cc:1225:19: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/gimple-ssa-sprintf.cc:1664:12: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] 1 ../../trunk.git/gcc/rtl.h:../../trunk.git/gcc/function-abi.h:184:13: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] 1 :../../trunk.git/gcc/rtl.h warning: :use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]1237 5 ../../trunk.git/gcc/rtl-ssa/internals.inl:436:25: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] On the evidence of the source code of gcc, this new clang warning might be worth implementing in gcc.=