public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/104948] When '&&' present in a comparison, a warning should be generated
Date: Wed, 16 Mar 2022 08:51:03 +0000	[thread overview]
Message-ID: <bug-104948-4-8Jtvj5BCE5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104948-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
unary operator vs binary operator.

You are just confused really.

that is if used as an unary operator, it will taken as the address of the
lable. While used as a binary operator it will be used as you expect.

Also the warning already happens with -Waddress (which is enabled with -Wall)"
<source>: In function 'f':
<source>:3:9: warning: the address of 'a' will always evaluate as 'true'
[-Waddress]
     if (&&a) return 1;

  parent reply	other threads:[~2022-03-16  8:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16  8:42 [Bug c/104948] New: " coenraad at wish dot org.za
2022-03-16  8:44 ` [Bug c/104948] " coenraad at wish dot org.za
2022-03-16  8:51 ` pinskia at gcc dot gnu.org [this message]
2022-03-16  9:07 ` coenraad at wish dot org.za
2022-03-16  9:10 ` pinskia at gcc dot gnu.org
2022-03-16  9:10 ` pinskia at gcc dot gnu.org
2022-03-16  9:13 ` rguenth at gcc dot gnu.org
2022-03-16  9:33 ` redi at gcc dot gnu.org
2022-03-16 11:20 ` coenraad at wish dot org.za
2022-03-16 12:34 ` redi at gcc dot gnu.org
2022-03-16 12:40 ` jakub at gcc dot gnu.org
2022-03-16 12:56 ` schwab@linux-m68k.org
2022-03-16 13:04 ` redi at gcc dot gnu.org
2022-03-17  9:03 ` coenraad at wish dot org.za
2022-03-17 10:43 ` [Bug c/104948] When '&&' has non bool parameters, a better " redi at gcc dot gnu.org

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-104948-4-8Jtvj5BCE5@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).