[Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
manu at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Oct 24 10:12:00 GMT 2008
------- Comment #14 from manu at gcc dot gnu dot org 2008-10-24 10:10 -------
Subject: Bug 7543
Author: manu
Date: Fri Oct 24 10:09:06 2008
New Revision: 141340
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141340
Log:
2008-10-24 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/7543
* value-prof.c (gimple_stringop_fixed_value): Use parentheses
around bit operation.
* profile.c (is_edge_inconsistent): Likewise.
* fold-const.c (truth_value_p): Move from here...
* tree.h (truth_value_p): ... to here.
* c-tree.h (c_expr): Update description of original_code.
* c-typeck.c (parser_build_unary_op): Set original_code.
(parser_build_binary_op): Update call to warn_about_parentheses.
* c-common.c (warn_about_parentheses): Take two additional
arguments of the operands. Use a switch. Quote operators
appropriately. Define macro APPEARS_TO_BE_BOOLEAN_EXPR_P.
Add warning about !x | y and !x & y.
* c-common.h (warn_about_parentheses): Update declaration.
cp/
* typeck.c (build_x_binary_op): Update call to
warn_about_parentheses.
* parser.c (cp_parser_binary_expression): Add note about passing
the correct code for unary expressions.
testsuite/
* gcc.dg/Wparentheses-11.c: New.
* g++.dg/warn/Wparentheses-25.C: New. XFAILED.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wparentheses-25.C
trunk/gcc/testsuite/gcc.dg/Wparentheses-11.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-common.c
trunk/gcc/c-common.h
trunk/gcc/c-tree.h
trunk/gcc/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/cp/typeck.c
trunk/gcc/fold-const.c
trunk/gcc/profile.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree.h
trunk/gcc/value-prof.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7543
More information about the Gcc-bugs
mailing list