public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61276] New: warn about possible coding errors with logical not (!)
@ 2014-05-21 16:08 manu at gcc dot gnu.org
2014-05-21 16:18 ` [Bug c++/61276] " dcb314 at hotmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2014-05-21 16:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
Bug ID: 61276
Summary: warn about possible coding errors with logical not (!)
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: manu at gcc dot gnu.org
CC: dcb314 at hotmail dot com
Depends on: 61271
+++ This bug was initially created as a clone of Bug #61271 +++
Clang detects this:
../../src/trunk/gcc/cgraphunit.c:1182:8: warning: logical not is only applied
to the left hand side of this comparison [-Wlogical-not-parentheses]
Source code is
&& (! TREE_CODE (target_node->decl) == FUNCTION_DECL
where
&& (TREE_CODE (target_node->decl) != FUNCTION_DECL)
was intended.
GCC should have this warning which would have detected several obvious bugs in
GCC itself.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/61276] warn about possible coding errors with logical not (!)
2014-05-21 16:08 [Bug c++/61276] New: warn about possible coding errors with logical not (!) manu at gcc dot gnu.org
@ 2014-05-21 16:18 ` dcb314 at hotmail dot com
2014-05-21 17:15 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2014-05-21 16:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Manuel López-Ibáñez from comment #0)
> GCC should have this warning which would have detected several obvious bugs
> in GCC itself.
And at least 60 bugs in Fedora Linux, based on compiling
Fedora Linux with clang.
It would also find an unknown number of bugs in Linux kernel,
which compiles with gcc only, sadly.
>From gcc-bugs-return-452186-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 21 16:20:37 2014
Return-Path: <gcc-bugs-return-452186-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11006 invoked by alias); 21 May 2014 16:20:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10957 invoked by uid 48); 21 May 2014 16:20:31 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61276] warn about possible coding errors with logical not (!)
Date: Wed, 21 May 2014 16:20:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61276-4-kI3tAN9AbK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61276-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61276-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01878.txt.bz2
Content-length: 358
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Just to mention that I cloned PR 61271 to not forget about implementing the
warning once the problematic code is fixed. So this PR should be about
implementing the warning, rather than fixing any particular problems.
>From gcc-bugs-return-452187-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 21 16:25:16 2014
Return-Path: <gcc-bugs-return-452187-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13566 invoked by alias); 21 May 2014 16:25:16 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13540 invoked by uid 48); 21 May 2014 16:25:12 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61276] warn about possible coding errors with logical not (!)
Date: Wed, 21 May 2014 16:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61276-4-gunk826NSQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61276-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61276-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01879.txt.bz2
Content-length: 597
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to David Binderman from comment #2)
> It would also find an unknown number of bugs in Linux kernel,
> which compiles with gcc only, sadly.
Which I find sad is that GCC does not have such a simple warning after +20
years of development.
Can't Google/RedHat/Oracle/Suse/Mentor/ARM/Linaro poll resources and have at
least one GCC developer committed to diagnostic issues? Just a single one
full-time developer will make such a huge difference.
>From gcc-bugs-return-452188-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 21 16:35:24 2014
Return-Path: <gcc-bugs-return-452188-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19807 invoked by alias); 21 May 2014 16:35:23 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19741 invoked by uid 55); 21 May 2014 16:35:20 -0000
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/56955] documentation for attribute malloc contradicts itself
Date: Wed, 21 May 2014 16:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenther at suse dot de
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56955-4-EY2B8X0zV6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56955-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56955-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01880.txt.bz2
Content-length: 818
https://gcc.gnu.org/bugzilla/show_bug.cgi?idV955
--- Comment #19 from rguenther at suse dot de <rguenther at suse dot de> ---
On May 21, 2014 5:14:27 PM CEST, eggert at gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?idV955
>
>--- Comment #18 from Paul Eggert <eggert at gnu dot org> ---
>(In reply to Richard Biener from comment #16)
>
>> void foo (int *p)
>> {
>> int *q = realloc (p, sizeof (int));
>> *q = 2;
>> }
>>
>> may I remove the store *q = 2 as dead?
>
>Yes, the consensus nowadays is that you can.
>
>I'll be happy to send the proposed change to gcc-patches but would like
>to be
>sure it's correct first. Has this new information about realloc
>changed your
>opinion about whether realloc can be given the malloc attribute?
No, it has not.
Richard.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/61276] warn about possible coding errors with logical not (!)
2014-05-21 16:08 [Bug c++/61276] New: warn about possible coding errors with logical not (!) manu at gcc dot gnu.org
2014-05-21 16:18 ` [Bug c++/61276] " dcb314 at hotmail dot com
@ 2014-05-21 17:15 ` redi at gcc dot gnu.org
2014-05-21 17:27 ` joseph at codesourcery dot com
2014-06-01 18:19 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-21 17:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #3)
> Just to mention that I cloned PR 61271 to not forget about implementing the
> warning once the problematic code is fixed. So this PR should be about
> implementing the warning, rather than fixing any particular problems.
Oops, sorry I didn't read it properly!
(In reply to Manuel López-Ibáñez from comment #4)
> Can't Google/RedHat/Oracle/Suse/Mentor/ARM/Linaro poll resources and have at
> least one GCC developer committed to diagnostic issues? Just a single one
> full-time developer will make such a huge difference.
Although I agree with the sentiment it's just not practical, a full-time
developer can't really have seven different employers.
>From gcc-bugs-return-452191-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 21 17:23:50 2014
Return-Path: <gcc-bugs-return-452191-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17192 invoked by alias); 21 May 2014 17:23:50 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17147 invoked by uid 55); 21 May 2014 17:23:41 -0000
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61133] g++ doesn't implement DR1760
Date: Wed, 21 May 2014 17:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords: accepts-invalid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jason at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61133-4-Mx8PhSVnXW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61133-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61133-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01883.txt.bz2
Content-length: 551
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida133
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed May 21 17:23:07 2014
New Revision: 210720
URL: http://gcc.gnu.org/viewcvs?rev!0720&root=gcc&view=rev
Log:
PR c++/61133
* lambda.c (build_capture_proxy, add_capture): Treat normal
captures and init-captures identically.
Added:
trunk/gcc/testsuite/g++.dg/cpp1y/lambda-init8.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/lambda.c
trunk/gcc/testsuite/g++.dg/cpp1y/lambda-init6.C
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/61276] warn about possible coding errors with logical not (!)
2014-05-21 16:08 [Bug c++/61276] New: warn about possible coding errors with logical not (!) manu at gcc dot gnu.org
2014-05-21 16:18 ` [Bug c++/61276] " dcb314 at hotmail dot com
2014-05-21 17:15 ` redi at gcc dot gnu.org
@ 2014-05-21 17:27 ` joseph at codesourcery dot com
2014-06-01 18:19 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2014-05-21 17:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
You could suggest GCC diagnostic issues to
http://www.linuxfoundation.org/programs/core-infrastructure-initiative if
you wish....
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/61276] warn about possible coding errors with logical not (!)
2014-05-21 16:08 [Bug c++/61276] New: warn about possible coding errors with logical not (!) manu at gcc dot gnu.org
` (2 preceding siblings ...)
2014-05-21 17:27 ` joseph at codesourcery dot com
@ 2014-06-01 18:19 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-06-01 18:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61276
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 #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a (untested) patch for both C/C++ FEs.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-01 18:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-21 16:08 [Bug c++/61276] New: warn about possible coding errors with logical not (!) manu at gcc dot gnu.org
2014-05-21 16:18 ` [Bug c++/61276] " dcb314 at hotmail dot com
2014-05-21 17:15 ` redi at gcc dot gnu.org
2014-05-21 17:27 ` joseph at codesourcery dot com
2014-06-01 18:19 ` mpolacek 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).