This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/80085] New: missing -Wlogical-op on a superfluous second operand of &&


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;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]