------- Comment #1 from joseph at codesourcery dot com  2010-09-09 12:20 -------
Subject: Re:   New: misleading warning when && operator paired
 with a constant - is it operator precedence?

You don't give a self-contained testcase whose behavior with different 
versions can be compared, but the warnings now are

      if (or_op)
        warning_at (location, OPT_Wlogical_op, "logical %<or%>"
                    " applied to non-boolean constant");
      else
        warning_at (location, OPT_Wlogical_op, "logical %<and%>"
                    " applied to non-boolean constant");

and the reason is

  /* Warn if &&/|| are being used in a context where it is
     likely that the bitwise equivalent was intended by the
     programmer. That is, an expression such as op && MASK
     where op should not be any boolean expression, nor a
     constant, and mask seems to be a non-boolean integer constant.  */


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45610

Reply via email to