public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH resend] Make -Wuse-after-free=3 the default one in -Wall
       [not found] <3d7d07cf-3276-b091-69d5-bf00b04e518d@gotplt.org>
@ 2023-02-17 23:05 ` Alejandro Colomar
  2023-03-15 14:30   ` Ping: " Alejandro Colomar
  0 siblings, 1 reply; 4+ messages in thread
From: Alejandro Colomar @ 2023-02-17 23:05 UTC (permalink / raw)
  To: gcc-patches
  Cc: Alejandro Colomar, Andreas Schwab, David Malcolm, Florian Weimer,
	Iker Pedrosa, Jens Gustedt, Jonathan Wakely, Mark Wielaard,
	Martin Uecker, Michael Kerrisk, Paul Eggert, Sam James,
	Siddhesh Poyarekar, Yann Droneaud

Link: <https://inbox.sourceware.org/gcc/3098fd18-9dbf-b4e9-bae5-62ec6fea74cd@opteya.com/T/>
Link: <https://github.com/shadow-maint/shadow/pull/649#discussion_r1108350066>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: David Malcolm <dmalcolm@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: Jens Gustedt <jens.gustedt@inria.fr>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Mark Wielaard <mark@klomp.org>
Cc: Martin Uecker <uecker@tugraz.at>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Sam James <sam@gentoo.org>
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---

This is a resend of the same patch previously sent to gcc@.

 gcc/c-family/c.opt  | 4 ++--
 gcc/doc/invoke.texi | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index c0fea56a8f5..1a3fc2c5d74 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1411,11 +1411,11 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_unused_const_variable)
 Warn when a const variable is unused.
 
 ; Defining this option here in addition to common.opt is necessary
-; in order for the default -Wall setting of -Wuse-after-free=2 to take
+; in order for the default -Wall setting of -Wuse-after-free=3 to take
 ; effect.
 
 Wuse-after-free=
-LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,2,0)
+LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,3,0)
 ; in common.opt
 
 Wvariadic-macros
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7b308cd3c31..d910052ce0c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4720,7 +4720,7 @@ instead of pointers.  This approach obviates needing to adjust the stored
 pointers after reallocation.
 @end table
 
-@option{-Wuse-after-free=2} is included in @option{-Wall}.
+@option{-Wuse-after-free=3} is included in @option{-Wall}.
 
 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
 @opindex Wuseless-cast
-- 
2.39.1


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

* Ping: [PATCH resend] Make -Wuse-after-free=3 the default one in -Wall
  2023-02-17 23:05 ` [PATCH resend] Make -Wuse-after-free=3 the default one in -Wall Alejandro Colomar
@ 2023-03-15 14:30   ` Alejandro Colomar
  2023-03-15 14:52     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Alejandro Colomar @ 2023-03-15 14:30 UTC (permalink / raw)
  To: gcc-patches
  Cc: Alejandro Colomar, Andreas Schwab, David Malcolm, Florian Weimer,
	Iker Pedrosa, Jens Gustedt, Jonathan Wakely, Mark Wielaard,
	Martin Uecker, Michael Kerrisk, Paul Eggert, Sam James,
	Siddhesh Poyarekar, Yann Droneaud


[-- Attachment #1.1: Type: text/plain, Size: 2386 bytes --]

Ping

On 2/18/23 00:05, Alejandro Colomar wrote:
> Link: <https://inbox.sourceware.org/gcc/3098fd18-9dbf-b4e9-bae5-62ec6fea74cd@opteya.com/T/>
> Link: <https://github.com/shadow-maint/shadow/pull/649#discussion_r1108350066>
> Cc: Andreas Schwab <schwab@linux-m68k.org>
> Cc: David Malcolm <dmalcolm@redhat.com>
> Cc: Florian Weimer <fweimer@redhat.com>
> Cc: Iker Pedrosa <ipedrosa@redhat.com>
> Cc: Jens Gustedt <jens.gustedt@inria.fr>
> Cc: Jonathan Wakely <jwakely.gcc@gmail.com>
> Cc: Mark Wielaard <mark@klomp.org>
> Cc: Martin Uecker <uecker@tugraz.at>
> Cc: Michael Kerrisk <mtk.manpages@gmail.com>
> Cc: Paul Eggert <eggert@cs.ucla.edu>
> Cc: Sam James <sam@gentoo.org>
> Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
> Cc: Yann Droneaud <ydroneaud@opteya.com>
> Signed-off-by: Alejandro Colomar <alx@kernel.org>
> ---
> 
> This is a resend of the same patch previously sent to gcc@.
> 
>  gcc/c-family/c.opt  | 4 ++--
>  gcc/doc/invoke.texi | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> index c0fea56a8f5..1a3fc2c5d74 100644
> --- a/gcc/c-family/c.opt
> +++ b/gcc/c-family/c.opt
> @@ -1411,11 +1411,11 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_unused_const_variable)
>  Warn when a const variable is unused.
>  
>  ; Defining this option here in addition to common.opt is necessary
> -; in order for the default -Wall setting of -Wuse-after-free=2 to take
> +; in order for the default -Wall setting of -Wuse-after-free=3 to take
>  ; effect.
>  
>  Wuse-after-free=
> -LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,2,0)
> +LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,3,0)
>  ; in common.opt
>  
>  Wvariadic-macros
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 7b308cd3c31..d910052ce0c 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -4720,7 +4720,7 @@ instead of pointers.  This approach obviates needing to adjust the stored
>  pointers after reallocation.
>  @end table
>  
> -@option{-Wuse-after-free=2} is included in @option{-Wall}.
> +@option{-Wuse-after-free=3} is included in @option{-Wall}.
>  
>  @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
>  @opindex Wuseless-cast

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Ping: [PATCH resend] Make -Wuse-after-free=3 the default one in -Wall
  2023-03-15 14:30   ` Ping: " Alejandro Colomar
@ 2023-03-15 14:52     ` Richard Biener
  2023-03-15 15:13       ` Alejandro Colomar
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2023-03-15 14:52 UTC (permalink / raw)
  To: Alejandro Colomar
  Cc: gcc-patches, Alejandro Colomar, Andreas Schwab, David Malcolm,
	Florian Weimer, Iker Pedrosa, Jens Gustedt, Jonathan Wakely,
	Mark Wielaard, Martin Uecker, Michael Kerrisk, Paul Eggert,
	Sam James, Siddhesh Poyarekar, Yann Droneaud

On Wed, Mar 15, 2023 at 3:30 PM Alejandro Colomar via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Ping

-Wuse-after-free=3 was explicitly added to cover cases with a high
false-positive rate.  If you want to
make that the default then instead merge the equality compare case
back to the =2 case.

But as I said elsewhere I think that -Wuse-after-free is very much too
trigger happy, especially
with value-uses (not accessing released memory but inspecting the old
pointer value).  Please consider
looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104075 and
review the false positives
reported.

Also see my very recent patches from today trying to limit
-Wuse-after-free by not diagnosing
from late IL.

Richard.

> On 2/18/23 00:05, Alejandro Colomar wrote:
> > Link: <https://inbox.sourceware.org/gcc/3098fd18-9dbf-b4e9-bae5-62ec6fea74cd@opteya.com/T/>
> > Link: <https://github.com/shadow-maint/shadow/pull/649#discussion_r1108350066>
> > Cc: Andreas Schwab <schwab@linux-m68k.org>
> > Cc: David Malcolm <dmalcolm@redhat.com>
> > Cc: Florian Weimer <fweimer@redhat.com>
> > Cc: Iker Pedrosa <ipedrosa@redhat.com>
> > Cc: Jens Gustedt <jens.gustedt@inria.fr>
> > Cc: Jonathan Wakely <jwakely.gcc@gmail.com>
> > Cc: Mark Wielaard <mark@klomp.org>
> > Cc: Martin Uecker <uecker@tugraz.at>
> > Cc: Michael Kerrisk <mtk.manpages@gmail.com>
> > Cc: Paul Eggert <eggert@cs.ucla.edu>
> > Cc: Sam James <sam@gentoo.org>
> > Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
> > Cc: Yann Droneaud <ydroneaud@opteya.com>
> > Signed-off-by: Alejandro Colomar <alx@kernel.org>
> > ---
> >
> > This is a resend of the same patch previously sent to gcc@.
> >
> >  gcc/c-family/c.opt  | 4 ++--
> >  gcc/doc/invoke.texi | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> > index c0fea56a8f5..1a3fc2c5d74 100644
> > --- a/gcc/c-family/c.opt
> > +++ b/gcc/c-family/c.opt
> > @@ -1411,11 +1411,11 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_unused_const_variable)
> >  Warn when a const variable is unused.
> >
> >  ; Defining this option here in addition to common.opt is necessary
> > -; in order for the default -Wall setting of -Wuse-after-free=2 to take
> > +; in order for the default -Wall setting of -Wuse-after-free=3 to take
> >  ; effect.
> >
> >  Wuse-after-free=
> > -LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,2,0)
> > +LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,3,0)
> >  ; in common.opt
> >
> >  Wvariadic-macros
> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > index 7b308cd3c31..d910052ce0c 100644
> > --- a/gcc/doc/invoke.texi
> > +++ b/gcc/doc/invoke.texi
> > @@ -4720,7 +4720,7 @@ instead of pointers.  This approach obviates needing to adjust the stored
> >  pointers after reallocation.
> >  @end table
> >
> > -@option{-Wuse-after-free=2} is included in @option{-Wall}.
> > +@option{-Wuse-after-free=3} is included in @option{-Wall}.
> >
> >  @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
> >  @opindex Wuseless-cast
>
> --
> <http://www.alejandro-colomar.es/>
> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

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

* Re: Ping: [PATCH resend] Make -Wuse-after-free=3 the default one in -Wall
  2023-03-15 14:52     ` Richard Biener
@ 2023-03-15 15:13       ` Alejandro Colomar
  0 siblings, 0 replies; 4+ messages in thread
From: Alejandro Colomar @ 2023-03-15 15:13 UTC (permalink / raw)
  To: Richard Biener
  Cc: gcc-patches, Alejandro Colomar, Andreas Schwab, David Malcolm,
	Florian Weimer, Iker Pedrosa, Jens Gustedt, Jonathan Wakely,
	Mark Wielaard, Martin Uecker, Michael Kerrisk, Paul Eggert,
	Sam James, Siddhesh Poyarekar, Yann Droneaud


[-- Attachment #1.1: Type: text/plain, Size: 1028 bytes --]

Hi Richard,

On 3/15/23 15:52, Richard Biener wrote:
> On Wed, Mar 15, 2023 at 3:30 PM Alejandro Colomar via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> Ping
> 
> -Wuse-after-free=3 was explicitly added to cover cases with a high
> false-positive rate.  If you want to
> make that the default then instead merge the equality compare case
> back to the =2 case.
> 
> But as I said elsewhere I think that -Wuse-after-free is very much too
> trigger happy, especially
> with value-uses (not accessing released memory but inspecting the old
> pointer value).  Please consider
> looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104075 and
> review the false positives
> reported.
> 
> Also see my very recent patches from today trying to limit
> -Wuse-after-free by not diagnosing
> from late IL.

Hmmm, thanks, didn't know about those.  Please ignore my patch.

Cheers,

Alex


-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-03-15 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3d7d07cf-3276-b091-69d5-bf00b04e518d@gotplt.org>
2023-02-17 23:05 ` [PATCH resend] Make -Wuse-after-free=3 the default one in -Wall Alejandro Colomar
2023-03-15 14:30   ` Ping: " Alejandro Colomar
2023-03-15 14:52     ` Richard Biener
2023-03-15 15:13       ` Alejandro Colomar

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