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

            Bug ID: 64250
           Summary: Missing warning for "if (AA && AA)" / same expression
                    multiple times used
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org

Related to PR64249.

The following code gives the cppcheck warning:
  [foo.c:2] -> [foo.c:2]: (style) Same expression on both sides of '&&'.

I couldn't get GCC to warn for this. (Real-world code, I assume it should be a
check for 'a' 'l' 'l'.)

Similar: A check for "||".


int foo(const char *argument) {
  if (argument[0] == 'a' && argument[0] == 'a' && argument[0] == 'a')
    return 1;
  return 0;
}

Reply via email to