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

            Bug ID: 80085
           Summary: missing -Wlogical-op on a superfluous second operand
                    of &&
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The test case below, reduced from bug 80050 in GCC sources, shows a case of a
missing -Wlogical-op warning for the second operand of the && expression which
is trivially satisfied by the first operand.

$ cat u.c && gcc -S -Wall -Wextra -Wpedantic -Wlogical-op u.c
int f (int i)
{
  if (i == 123 && i != 456)
    return 1;

  return 2;
}

Reply via email to