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/61271] 6 * possible coding error with logical not (!)


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

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
Even more:

7.

src/trunk/gcc/lra-spills.c:240:9: warning: logical not is only applied to the
left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

        || !FRAME_GROWS_DOWNWARD == STACK_GROWS_DOWNWARD ? diff : -diff);

Looks like #6

8.

trunk/gcc/sel-sched-ir.c:6189:30: warning: logical not is only applied to the
left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

      if (bb->loop_father && !bb->loop_father->num == 0

Maybe

      if (bb->loop_father && bb->loop_father->num != 0

9.

trunk/gcc/tree-vect-data-refs.c:1833:11: warning: logical not is only applied
to the left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

      if (!LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo))

but

#define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
  (L)->may_misalign_stmts.length () > 0

Maybe 

#define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
  ((L)->may_misalign_stmts.length () > 0)

might fix the problem.

10.

trunk/gcc/tree-vect-loop.c:1795:14: warning: logical not is only applied to the
left hand side of this comparison [-Wlogical-not-parentheses]
trunk/gcc/tree-vect-loop.c:1796:17: warning: logical not is only applied to the
left hand side of this comparison [-Wlogical-not-parentheses]

Source code is

           && ((!LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo)
                && !LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo))


Maybe something like

#define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L)     \
  ((L)->may_alias_ddrs.length () > 0)

might solve the problem.


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