public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63357] New: Warn for P && P and P || P
@ 2014-09-24 10:26 mpolacek at gcc dot gnu.org
  2014-12-10  8:56 ` [Bug c/63357] " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-24 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63357
           Summary: Warn for P && P and P || P
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org

We probably should warn about (both C/C++):

int
foo (int a, int b)
{
  if (a && a)
    return 1;
  if (b || b)
    return 2;
  if (!a && !a)
    return 3;
  if (!b || !b)
    return 4;
  return 0;
}

See https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02080.html

I suggest this be called -Wredundant-op.  Better names?


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-24 14:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24 10:26 [Bug c/63357] New: Warn for P && P and P || P mpolacek at gcc dot gnu.org
2014-12-10  8:56 ` [Bug c/63357] " mpolacek at gcc dot gnu.org
2014-12-10  9:22 ` [Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition) burnus at gcc dot gnu.org
2015-04-21  6:04 ` mpolacek at gcc dot gnu.org
2015-04-22 10:01 ` mpolacek at gcc dot gnu.org
2015-04-24 12:11 ` mpolacek at gcc dot gnu.org
2015-04-24 12:12 ` mpolacek at gcc dot gnu.org
2023-02-24  8:56 ` dcb314 at hotmail dot com
2023-02-24 10:49 ` manu at gcc dot gnu.org
2023-02-24 14:23 ` dcb314 at hotmail dot com

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).