docs: document sanitizers can trigger warnings

Message ID 9321d38e-a185-5505-62a5-574d64446798@suse.cz
State Accepted
Headers
Series docs: document sanitizers can trigger warnings |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Martin Liška Oct. 26, 2022, 11:09 a.m. UTC
  PR sanitizer/107298

gcc/ChangeLog:

	* doc/invoke.texi: Document sanitizers can trigger warnings.
---
 gcc/doc/invoke.texi | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Jeff Law Oct. 27, 2022, 10:52 p.m. UTC | #1
On 10/26/22 05:09, Martin Liška wrote:
> 	PR sanitizer/107298
>
> gcc/ChangeLog:
>
> 	* doc/invoke.texi: Document sanitizers can trigger warnings.

OK

jeff
  
Eric Gallager Oct. 28, 2022, 6:45 p.m. UTC | #2
On Wed, Oct 26, 2022 at 7:09 AM Martin Liška <mliska@suse.cz> wrote:
>
>         PR sanitizer/107298
>
> gcc/ChangeLog:
>
>         * doc/invoke.texi: Document sanitizers can trigger warnings.
> ---
>  gcc/doc/invoke.texi | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 64f77e8367a..1ffbba16a72 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -16460,6 +16460,10 @@ by this option.
>
>  @end table
>
> +Note the enabled sanitizer options tend to increase a false-positive rate
> +of selected warnings, most notably @option{-Wmaybe-uninitialized}.
> +And thus we recommend to disable @option{-Werror}.
> +

I'd recommend rewording the second sentence there as:
"Thus, GCC developers recommend disabling @option{-Werror} when using
sanitizer options."

>  While @option{-ftrapv} causes traps for signed overflows to be emitted,
>  @option{-fsanitize=undefined} gives a diagnostic message.
>  This currently works only for the C family of languages.
> --
> 2.38.0
>
  
Gerald Pfeifer Nov. 3, 2022, 12:32 p.m. UTC | #3
Hi Martin,

On Wed, 26 Oct 2022, Martin Liška wrote:
> +Note the enabled sanitizer options tend to increase a false-positive rate
> +of selected warnings, most notably @option{-Wmaybe-uninitialized}.
> +And thus we recommend to disable @option{-Werror}.

I've been sitting muling over this and here is what I'm wondering might
be a possible alternative?

  Note that sanitzers tend to increase the rate of false positive
  warnings, most notably those around @option{-Wmaybe-uninitialized}.
  We recommend against combining @option{-Werror} and [the use of] 
  sanitzers.


Rationale for the second sentence: Disabling a warning that is off by 
default confused my mental model (and maybe those of other readers). :-)

What do you think?

Gerald
  
Martin Liška Nov. 7, 2022, 8:55 a.m. UTC | #4
On 11/3/22 13:32, Gerald Pfeifer wrote:
> Hi Martin,
> 
> On Wed, 26 Oct 2022, Martin Liška wrote:
>> +Note the enabled sanitizer options tend to increase a false-positive rate
>> +of selected warnings, most notably @option{-Wmaybe-uninitialized}.
>> +And thus we recommend to disable @option{-Werror}.
> 
> I've been sitting muling over this and here is what I'm wondering might
> be a possible alternative?
> 
>   Note that sanitzers tend to increase the rate of false positive
>   warnings, most notably those around @option{-Wmaybe-uninitialized}.
>   We recommend against combining @option{-Werror} and [the use of] 
>   sanitzers.
> 
> 
> Rationale for the second sentence: Disabling a warning that is off by 
> default confused my mental model (and maybe those of other readers). :-)
> 
> What do you think?

I welcome it and I've pushed pushed your version.

Thanks,
Martin

> 
> Gerald
  

Patch

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 64f77e8367a..1ffbba16a72 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -16460,6 +16460,10 @@  by this option.
 
 @end table
 
+Note the enabled sanitizer options tend to increase a false-positive rate
+of selected warnings, most notably @option{-Wmaybe-uninitialized}.
+And thus we recommend to disable @option{-Werror}.
+
 While @option{-ftrapv} causes traps for signed overflows to be emitted,
 @option{-fsanitize=undefined} gives a diagnostic message.
 This currently works only for the C family of languages.