[Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value

jsm at polyomino dot org dot uk gcc-bugzilla@gcc.gnu.org
Fri Oct 1 15:28:00 GMT 2004


------- Additional Comments From jsm at polyomino dot org dot uk  2004-10-01 15:28 -------
Subject: Re:  no warning for always-false "if (!a & 0x4)" bitwise
 and on boolean value

On Fri, 1 Oct 2004, bangerth at dealii dot org wrote:

> Joseph, would you mind commenting on the usefulness of an approach as mentioned 
> in the patch linked from comment #1? 

It seems reasonable to me - and as a -Wparentheses warning it avoids the 
question of whether the fold-const.c warnings really should be mandatory.

The patch would need updating for the removal of C_EXP_ORIGINAL_CODE and 
its replacement by c_expr structures.  The patch should cause the 
original_code be set appropriately (in the parser for now) where this 
patch requires it.  gcc.dg/Wparentheses-[2-8].c give examples of testing 
-Wparentheses warnings: test all relevant combinations of operators, both 
parenthesised and non-parenthesised, with constant and non-constant 
operands, and make sure each case does or does not warn as appropriate.



-- 


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



More information about the Gcc-bugs mailing list