public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-105164-4-zTRJpPaYlo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105164-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105164

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
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 > /tmp/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 '&' with
boolean operands [-Wbitwise-instead-of-logical]
      1 ../../trunk.git/gcc/cp/lex.cc:571:11: warning: use of bitwise '&' with
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 bitwise
'&' 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::1841750::1319::
 warning: warning: use of bitwise '&' with boolean operands
[-Wbitwise-instead-of-logical]array index 1 is past the end of the array (which
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.

  reply	other threads:[~2022-04-05 21:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 16:16 [Bug c++/105164] New: " dcb314 at hotmail dot com
2022-04-05 21:24 ` dcb314 at hotmail dot com [this message]
2022-04-06  7:51 ` [Bug c++/105164] " rguenth at gcc dot gnu.org
2022-04-06  9:08 ` marxin at gcc dot gnu.org
2022-04-06 12:12 ` marxin at gcc dot gnu.org
2022-04-06 16:30 ` dcb314 at hotmail dot com
2022-04-06 16:32 ` dcb314 at hotmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105164-4-zTRJpPaYlo@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).