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?

Reply via email to