public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/17308] nonnull attribute not as useful as it could
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
@ 2011-02-11 17:00 ` ericb at gcc dot gnu.org
  2011-02-11 19:44 ` manu at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ericb at gcc dot gnu.org @ 2011-02-11 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Blake <ericb at gcc dot gnu.org> changed:

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

--- Comment #6 from Eric Blake <ericb at gcc dot gnu.org> 2011-02-11 16:58:01 UTC ---
It's been several years, and this attribute is still missing functionality
about warning for deduced NULL values.  Can this be looked at?


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

* [Bug middle-end/17308] nonnull attribute not as useful as it could
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
  2011-02-11 17:00 ` [Bug middle-end/17308] nonnull attribute not as useful as it could ericb at gcc dot gnu.org
@ 2011-02-11 19:44 ` manu at gcc dot gnu.org
  2012-04-25 19:32 ` ericb at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2011-02-11 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

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

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-02-11 19:43:20 UTC ---
(In reply to comment #6)
> It's been several years, and this attribute is still missing functionality
> about warning for deduced NULL values.  Can this be looked at?

GCC has as a unwritten policy to not emit warnings from the middle-end, except
for a few exceptions. The front-ends do not have the infrastructure to do this
kind of analysis, and GCC maintainers have repeatedly said that there is no
intention to make gcc front-ends serve as a source code analysis tool like the
clang analyzer. So, unless new contributors step forward with a convincing
implementation of this, and for what I mean by "convincing" please read point 3
in the notes to beginners[*], the answer is: No, I wouldn't expect this to be
implemented in the near or medium future. Sorry for the bad news, but I think
it is better to be honest and save you the frustration. 

[*] http://gcc.gnu.org/wiki/GCC_Research


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

* [Bug middle-end/17308] nonnull attribute not as useful as it could
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
  2011-02-11 17:00 ` [Bug middle-end/17308] nonnull attribute not as useful as it could ericb at gcc dot gnu.org
  2011-02-11 19:44 ` manu at gcc dot gnu.org
@ 2012-04-25 19:32 ` ericb at gcc dot gnu.org
  2012-04-25 20:04 ` manu at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ericb at gcc dot gnu.org @ 2012-04-25 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Eric Blake <ericb at gcc dot gnu.org> 2012-04-25 19:31:59 UTC ---
I hit this again today, and I'm still upset that gcc is doing such a poor job
with (not) using this attribute as a way to improve code quality via decent
warnings.

Basically, libvirt had an issue where we accidentally misused the nonnull
attribute marker; we had added the marker in a header file, then later changed
the C file to work with a NULL argument but without updating the header file to
match: https://bugzilla.redhat.com/show_bug.cgi?id=815270

The calling code managed to pass in a NULL pointer to a parameter based on the
semantics we saw in the .c file, but the NULL check in our function in question
was "helpfully" elided by gcc since the attribute was still present, all
without ever warning us that we were losing the NULL check.  As a result, the
code misbehaved when it dereferenced NULL.  If gcc is smart enough to elide
code based on the attribute, it should be smart enough to issue a warning that
we have dead code, and the only reason the code is assumed to be dead is
because of a suspicious attribute.  Had we had the warning, we would have known
to either remove our dead NULL check, or to fix the header to no longer have
the (now-inappropriate) attribute.

In other words, with a header like:

void foo(void *bar) __attribute__((nonnull(1)));

and a C file like:

void foo(void *bar) { if (!bar) abort(); }

Even if you decide that you are unable to warn about a call to foo(var) because
the only way to analyze that var might be NULL is in the middle end but the
warning is only emitted by the front end, AT LEAST you could have warned that
the 'if (!bar)' conditional is assumed to be dead code based on the attribute
placed on var.


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

* [Bug middle-end/17308] nonnull attribute not as useful as it could
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-04-25 19:32 ` ericb at gcc dot gnu.org
@ 2012-04-25 20:04 ` manu at gcc dot gnu.org
  2015-07-25 20:04 ` manu at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-25 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-25 20:00:44 UTC ---
(In reply to comment #8)
> Even if you decide that you are unable to warn about a call to foo(var) because
> the only way to analyze that var might be NULL is in the middle end but the
> warning is only emitted by the front end, AT LEAST you could have warned that
> the 'if (!bar)' conditional is assumed to be dead code based on the attribute
> placed on var.

GCC does not warn about unreachable code anymore:

http://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html

Someone would have to contribute a new -Wunreachable-code implementation. I
honestly don't know what kind of implementation would be acceptable by GCC
maintainers. Maybe one implemented in the FE? If so, it would require exactly
the same infrastructure necessary to implement what Ulrich asks for above.

Sorry, comment #7 still applies.


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

* [Bug middle-end/17308] nonnull attribute not as useful as it could
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-04-25 20:04 ` manu at gcc dot gnu.org
@ 2015-07-25 20:04 ` manu at gcc dot gnu.org
  2015-09-11 21:51 ` mark at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2015-07-25 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eike@sf-mail.de

--- Comment #10 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
*** Bug 46936 has been marked as a duplicate of this bug. ***
>From gcc-bugs-return-493337-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jul 25 20:04:16 2015
Return-Path: <gcc-bugs-return-493337-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 58175 invoked by alias); 25 Jul 2015 20:04: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 58055 invoked by uid 48); 25 Jul 2015 20:04:12 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/46936] turn __attribute__ ((nonnull (x))) into assert in debug mode
Date: Sat, 25 Jul 2015 20:04: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: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: DUPLICATE
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: bug_status cc resolution
Message-ID: <bug-46936-4-PGdjMp1zT5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-46936-4@http.gcc.gnu.org/bugzilla/>
References: <bug-46936-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: 2015-07/txt/msg02227.txt.bz2
Content-length: 717

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I think -fsanitize should already detect this at run time, but GCC could indeed
warn for those cases that it detects.

*** This bug has been marked as a duplicate of bug 17308 ***
>From gcc-bugs-return-493339-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jul 25 20:05:28 2015
Return-Path: <gcc-bugs-return-493339-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 69189 invoked by alias); 25 Jul 2015 20:05:28 -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 65325 invoked by uid 48); 25 Jul 2015 20:05:24 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/44081] Incorrect nonnull assumed in code generation
Date: Sat, 25 Jul 2015 20:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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: cc
Message-ID: <bug-44081-4-GpIjuPXwCm@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-44081-4@http.gcc.gnu.org/bugzilla/>
References: <bug-44081-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: 2015-07/txt/msg02229.txt.bz2
Content-length: 441

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

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

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Should we close this?
>From gcc-bugs-return-493340-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jul 25 20:12:35 2015
Return-Path: <gcc-bugs-return-493340-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 74174 invoked by alias); 25 Jul 2015 20:12:35 -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 74120 invoked by uid 48); 25 Jul 2015 20:12:31 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/64463] Add warning: returns_nonnull attribute on a function compared against NULL
Date: Sat, 25 Jul 2015 20:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
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: bug_status cf_reconfirmed_on cc blocked everconfirmed
Message-ID: <bug-64463-4-L3fnag8bgL@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64463-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64463-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: 2015-07/txt/msg02230.txt.bz2
Content-length: 827

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-25
                 CC|                            |manu at gcc dot gnu.org
             Blocks|                            |58689
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Confirmed. Related to PR17308. This is one of the things requested in PR58689.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58689
[Bug 58689] Enhance returns_nonnull
>From gcc-bugs-return-493341-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jul 25 20:39:31 2015
Return-Path: <gcc-bugs-return-493341-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 126430 invoked by alias); 25 Jul 2015 20:39:31 -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 126217 invoked by uid 48); 25 Jul 2015 20:39:27 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66996] [6 Regression] defined but not used [-Wunused-function]
Date: Sat, 25 Jul 2015 20:39: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: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66996-4-lr0wwW7oKm@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66996-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66996-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: 2015-07/txt/msg02231.txt.bz2
Content-length: 241

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf996

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The warning seems correct as Foo::~Foo is not used and the function can be used
outside of the current translation unit.


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

* [Bug middle-end/17308] nonnull attribute not as useful as it could
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2015-07-25 20:04 ` manu at gcc dot gnu.org
@ 2015-09-11 21:51 ` mark at gcc dot gnu.org
  2023-02-02 22:39 ` [Bug middle-end/17308] nonnull attribute not as useful as it could be pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: mark at gcc dot gnu.org @ 2015-09-11 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

Mark Wielaard <mark at gcc dot gnu.org> changed:

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

--- Comment #11 from Mark Wielaard <mark at gcc dot gnu.org> ---
(In reply to Eric Blake from comment #8)
> In other words, with a header like:
> 
> void foo(void *bar) __attribute__((nonnull(1)));
> 
> and a C file like:
> 
> void foo(void *bar) { if (!bar) abort(); }
> 
> Even if you decide that you are unable to warn about a call to foo(var)
> because the only way to analyze that var might be NULL is in the middle end
> but the warning is only emitted by the front end, AT LEAST you could have
> warned that the 'if (!bar)' conditional is assumed to be dead code based on
> the attribute placed on var.

This part has now been implemented:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00626.html


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

* [Bug middle-end/17308] nonnull attribute not as useful as it could be
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2015-09-11 21:51 ` mark at gcc dot gnu.org
@ 2023-02-02 22:39 ` pinskia at gcc dot gnu.org
  2023-02-02 22:39 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-02 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The patch was reverted, see PR 78817 on the reasons why.

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

* [Bug middle-end/17308] nonnull attribute not as useful as it could be
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2023-02-02 22:39 ` [Bug middle-end/17308] nonnull attribute not as useful as it could be pinskia at gcc dot gnu.org
@ 2023-02-02 22:39 ` pinskia at gcc dot gnu.org
  2023-02-02 22:43 ` pinskia at gcc dot gnu.org
  2023-02-03  1:19 ` segher at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-02 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

* [Bug middle-end/17308] nonnull attribute not as useful as it could be
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2023-02-02 22:39 ` pinskia at gcc dot gnu.org
@ 2023-02-02 22:43 ` pinskia at gcc dot gnu.org
  2023-02-03  1:19 ` segher at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-02 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The patch which would have "fixed" this was reverted as there was too many
false positives and that happens when you do optimization based warnings ...
I don't know if we want to keep this open or close this as won't fix though. 
It has been 6 years since this was tried too and we still most likely have just
as many false positives as before even.
I also suspect many of these new warnings we are doing in recent years really
should not be part of -Wall because of how many false positives we have. GCC
has been getting a recent attention because of the false positives warnings
too.

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

* [Bug middle-end/17308] nonnull attribute not as useful as it could be
       [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2023-02-02 22:43 ` pinskia at gcc dot gnu.org
@ 2023-02-03  1:19 ` segher at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: segher at gcc dot gnu.org @ 2023-02-03  1:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #23)
> I also suspect many of these new warnings we are doing in recent years
> really should not be part of -Wall because of how many false positives we
> have. GCC has been getting a recent attention because of the false positives
> warnings too.

Current documentation says

'-Wall'
     This enables all the warnings about constructions that some users
     consider questionable, and that are easy to avoid (or modify to
     prevent the warning), even in conjunction with macros.

and

'-Wextra'
     This enables some extra warning flags that are not enabled by
     '-Wall'.

We don't document at all what options should be enabled by -Wall, what
options should be enabled by -W, and which should be done by neither.  The
current documentation for -Wall is very noncommittal.

It all is a tradeoff of course.  IMO our documentation should make that clear
as well.

In my view, -Wall should enable all warnings that have few false positives
(less than 5% or 10%, say), and when they do this is easy to avoid, or perhaps
the warning points out very important (security) problems.

-W is the same but with higher tolerance for false positives.  And the
warnings that are not so useful, or are hard to avoid, and have a high false
positive rate, should not be enabled by either.

(Oh, and please note that -Werror is not part of these considerations at all.
When -Werror makes things "break" this is just a learning opportunity for
whoever asked for it.  Maybe we should document -Werror as an alias of
-Wself-flagellation).

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

end of thread, other threads:[~2023-02-03  1:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-17308-4@http.gcc.gnu.org/bugzilla/>
2011-02-11 17:00 ` [Bug middle-end/17308] nonnull attribute not as useful as it could ericb at gcc dot gnu.org
2011-02-11 19:44 ` manu at gcc dot gnu.org
2012-04-25 19:32 ` ericb at gcc dot gnu.org
2012-04-25 20:04 ` manu at gcc dot gnu.org
2015-07-25 20:04 ` manu at gcc dot gnu.org
2015-09-11 21:51 ` mark at gcc dot gnu.org
2023-02-02 22:39 ` [Bug middle-end/17308] nonnull attribute not as useful as it could be pinskia at gcc dot gnu.org
2023-02-02 22:39 ` pinskia at gcc dot gnu.org
2023-02-02 22:43 ` pinskia at gcc dot gnu.org
2023-02-03  1:19 ` segher 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).