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

            Bug ID: 61271
           Summary: 3 * possible coding error with logical not (!)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

I just compiled gcc trunk 20140521 with boot compiler clang++ -g -O2 -Wall
and it said

1.

../../src/trunk/gcc/cgraphunit.c:1182:8: warning: logical not is only applied
to the left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

      && (! TREE_CODE (target_node->decl) == FUNCTION_DECL

Maybe

      && (TREE_CODE (target_node->decl) != FUNCTION_DECL)

was intended.

2.

../../src/trunk/gcc/config/i386/i386.c:37905:10: warning: logical not is only
applied to the left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

           || (!GET_CODE (x) != LABEL_REF

Confusing with the double negative. Maybe

           || (GET_CODE (x) == LABEL_REF

was intended.

3.

../../src/trunk/gcc/cp/cp-array-notation.c:1420:7: warning: logical not is only
applied to the left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

  if (!TREE_CODE (type) == FUNCTION_TYPE)
    {
      error_at (loc, "array notation cannot be used with function type");
      return false;
    }

Maybe

  if (TREE_CODE (type) == FUNCTION_TYPE)
    {
      error_at (loc, "array notation cannot be used with function type");
      return false;
    }

was intended.

Reply via email to