public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <bug-7543-1574@http.gcc.gnu.org/bugzilla/>
@ 2007-01-20 18:06 ` manu at gcc dot gnu dot org
  2007-01-21  3:15 ` levon at movementarian dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-20 18:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from manu at gcc dot gnu dot org  2007-01-20 18:06 -------
Any news on this? Is this an important warning?


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <bug-7543-1574@http.gcc.gnu.org/bugzilla/>
  2007-01-20 18:06 ` [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value manu at gcc dot gnu dot org
@ 2007-01-21  3:15 ` levon at movementarian dot org
  2008-08-23 13:51 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: levon at movementarian dot org @ 2007-01-21  3:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from levon at movementarian dot org  2007-01-21 03:15 -------
It's been a cause of bugs time and time again, so yes, it's useful and
important.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <bug-7543-1574@http.gcc.gnu.org/bugzilla/>
  2007-01-20 18:06 ` [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value manu at gcc dot gnu dot org
  2007-01-21  3:15 ` levon at movementarian dot org
@ 2008-08-23 13:51 ` manu at gcc dot gnu dot org
  2008-10-24 10:12 ` manu at gcc dot gnu dot org
  2008-10-24 10:14 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-23 13:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from manu at gcc dot gnu dot org  2008-08-23 13:49 -------
(In reply to comment #8)
>  Thanks.  (By the way, if there a gcc person interested in such a list, please
> contact me.)

I am interested in such a list. Thanks in advance.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <bug-7543-1574@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-08-23 13:51 ` manu at gcc dot gnu dot org
@ 2008-10-24 10:12 ` manu at gcc dot gnu dot org
  2008-10-24 10:14 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-24 10:12 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1922 bytes --]



------- 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <bug-7543-1574@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2008-10-24 10:12 ` manu at gcc dot gnu dot org
@ 2008-10-24 10:14 ` manu at gcc dot gnu dot org
  4 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-24 10:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from manu at gcc dot gnu dot org  2008-10-24 10:12 -------
This is FIXED in GCC 4.4


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <20020808090600.7543.trt@sas.com>
  2004-10-01 14:14 ` trt at acm dot org
  2004-10-01 14:25 ` bangerth at dealii dot org
@ 2004-10-01 15:28 ` jsm at polyomino dot org dot uk
  2 siblings, 0 replies; 8+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-10-01 15:28 UTC (permalink / raw)
  To: gcc-bugs


------- 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <20020808090600.7543.trt@sas.com>
  2004-10-01 14:14 ` trt at acm dot org
@ 2004-10-01 14:25 ` bangerth at dealii dot org
  2004-10-01 15:28 ` jsm at polyomino dot org dot uk
  2 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-10-01 14:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-10-01 14:25 -------
As the example you show in your patch demonstrates, there are even cases inside 
gcc that would be triggered by this patch. I believe it would therefore be useful. 
Also, jsm's response was not dismissive of the patch at all, though we would indeed 
have to have a Changelog entry as well as testcases.  
 
Joseph, would you mind commenting on the usefulness of an approach as mentioned 
in the patch linked from comment #1? 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value
       [not found] <20020808090600.7543.trt@sas.com>
@ 2004-10-01 14:14 ` trt at acm dot org
  2004-10-01 14:25 ` bangerth at dealii dot org
  2004-10-01 15:28 ` jsm at polyomino dot org dot uk
  2 siblings, 0 replies; 8+ messages in thread
From: trt at acm dot org @ 2004-10-01 14:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From trt at acm dot org  2004-10-01 14:14 -------
Can we just close this 'wonfix'?  There are so many simpler/effective warning
message improvements that are available to gcc.  (e.g. the special case
of boolean & non-boolean-constant can be caught with a three-line addition
to fold() in fold-const.c)  This elaborate patch would be way way down any list.
 Thanks.  (By the way, if there a gcc person interested in such a list, please
contact me.)

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-10-24 10:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-7543-1574@http.gcc.gnu.org/bugzilla/>
2007-01-20 18:06 ` [Bug c/7543] no warning for always-false "if (!a & 0x4)" bitwise and on boolean value manu at gcc dot gnu dot org
2007-01-21  3:15 ` levon at movementarian dot org
2008-08-23 13:51 ` manu at gcc dot gnu dot org
2008-10-24 10:12 ` manu at gcc dot gnu dot org
2008-10-24 10:14 ` manu at gcc dot gnu dot org
     [not found] <20020808090600.7543.trt@sas.com>
2004-10-01 14:14 ` trt at acm dot org
2004-10-01 14:25 ` bangerth at dealii dot org
2004-10-01 15:28 ` jsm at polyomino dot org dot uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).