public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49706] New: No warning for (!x > 1) which is always false
@ 2011-07-11 22:34 pinskia at gcc dot gnu.org
  2011-07-12  8:53 ` [Bug c/49706] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-07-11 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: No warning for (!x > 1) which is always false
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Found this while looking into PR49474:
/* { dg-options "-Wextra -Wall" } */
void warn (void);
int f(int a)
{
  if (!a > 1) /* { dg-warning "false" } */
    warn();
  return 0;
}


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
@ 2011-07-12  8:53 ` rguenth at gcc dot gnu.org
  2011-07-12  9:28 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-12  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.12 08:51:27
     Ever Confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-12 08:51:27 UTC ---
Confirmed.


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
  2011-07-12  8:53 ` [Bug c/49706] " rguenth at gcc dot gnu.org
@ 2011-07-12  9:28 ` jakub at gcc dot gnu.org
  2014-06-01 18:31 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-12  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-12 09:27:38 UTC ---
-Wtype-limits is apparently just in shorten_compare and vrp, while here it is
optimized by fold.  For
_Bool x;
...
if (x > 1)
or
struct { unsigned int i : 1; } x;
...
if (x.i > 1)
we don't warn either.


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
  2011-07-12  8:53 ` [Bug c/49706] " rguenth at gcc dot gnu.org
  2011-07-12  9:28 ` jakub at gcc dot gnu.org
@ 2014-06-01 18:31 ` pinskia at gcc dot gnu.org
  2014-06-01 18:46 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-06-01 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 61276 has been marked as a duplicate of this bug. ***


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-06-01 18:31 ` pinskia at gcc dot gnu.org
@ 2014-06-01 18:46 ` mpolacek at gcc dot gnu.org
  2014-06-05  6:20 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-06-01 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.10.0

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a patch implementing -Wlogical-not-parentheses.


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-06-01 18:46 ` mpolacek at gcc dot gnu.org
@ 2014-06-05  6:20 ` mpolacek at gcc dot gnu.org
  2014-06-05  6:23 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-06-05  6:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Jun  5 06:20:05 2014
New Revision: 211255

URL: http://gcc.gnu.org/viewcvs?rev=211255&root=gcc&view=rev
Log:
    PR c/49706
    * doc/invoke.texi: Document -Wlogical-not-parentheses.
c-family/
    * c-common.c (warn_logical_not_parentheses): New function.
    * c-common.h (warn_logical_not_parentheses): Declare.
    * c.opt (Wlogical-not-parentheses): New option.
c/
    * c-typeck.c (parser_build_binary_op): Warn when logical not is used
    on the left hand side operand of a comparison. 
cp/
    * parser.c (cp_parser_binary_expression): Warn when logical not is
    used on the left hand side operand of a comparison.
testsuite/
    * c-c++-common/pr49706.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/pr49706.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-family/c.opt
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-06-05  6:20 ` mpolacek at gcc dot gnu.org
@ 2014-06-05  6:23 ` mpolacek at gcc dot gnu.org
  2014-09-01  9:32 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-06-05  6:23 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|mpolacek at gcc dot gnu.org        |unassigned at gcc dot gnu.org

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
-Wlogical-not-parentheses is in, but I'm not marking this as fixed yet as we
don't warn for #c2.  Maybe I will look at it, but unassigning for now.


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-06-05  6:23 ` mpolacek at gcc dot gnu.org
@ 2014-09-01  9:32 ` mpolacek at gcc dot gnu.org
  2015-04-22 11:58 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-01  9:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49706
Bug 49706 depends on bug 61271, which changed state.

Bug 61271 Summary: 10 * possible coding error with logical not (!)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61271

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


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-09-01  9:32 ` mpolacek at gcc dot gnu.org
@ 2015-04-22 11:58 ` jakub at gcc dot gnu.org
  2015-07-16  9:12 ` rguenth at gcc dot gnu.org
  2022-01-09  0:47 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-04-22 11:58 ` jakub at gcc dot gnu.org
@ 2015-07-16  9:12 ` rguenth at gcc dot gnu.org
  2022-01-09  0:47 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


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

* [Bug c/49706] No warning for (!x > 1) which is always false
  2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-07-16  9:12 ` rguenth at gcc dot gnu.org
@ 2022-01-09  0:47 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-09  0:47 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.5                         |---

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

end of thread, other threads:[~2022-01-09  0:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 22:34 [Bug c/49706] New: No warning for (!x > 1) which is always false pinskia at gcc dot gnu.org
2011-07-12  8:53 ` [Bug c/49706] " rguenth at gcc dot gnu.org
2011-07-12  9:28 ` jakub at gcc dot gnu.org
2014-06-01 18:31 ` pinskia at gcc dot gnu.org
2014-06-01 18:46 ` mpolacek at gcc dot gnu.org
2014-06-05  6:20 ` mpolacek at gcc dot gnu.org
2014-06-05  6:23 ` mpolacek at gcc dot gnu.org
2014-09-01  9:32 ` mpolacek at gcc dot gnu.org
2015-04-22 11:58 ` jakub at gcc dot gnu.org
2015-07-16  9:12 ` rguenth at gcc dot gnu.org
2022-01-09  0:47 ` pinskia at gcc dot gnu.org

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