[gcc r11-4630] Correct -Wstringop-overflow and -Wstringop-overread.

Martin Sebor msebor@gcc.gnu.org
Mon Nov 2 20:50:55 GMT 2020


https://gcc.gnu.org/g:9e3c694afacf965293fe8b3b7b9a5022415e03c9

commit r11-4630-g9e3c694afacf965293fe8b3b7b9a5022415e03c9
Author: Martin Sebor <msebor@redhat.com>
Date:   Mon Nov 2 13:47:45 2020 -0700

    Correct -Wstringop-overflow and -Wstringop-overread.
    
    gcc/ChangeLog:
            * doc/invoke.texi (-Wstringop-overflow): Correct default setting.
            (-Wstringop-overread): Move past -Wstringop-overflow.

Diff:
---
 gcc/doc/invoke.texi | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 492b7dcdf10..89168be1d2f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6899,37 +6899,28 @@ const char* f (enum Color clr)
 
 Option @option{-Wstringop-overflow=2} is enabled by default.
 
-@item -Wno-stringop-overread
-@opindex Wstringop-overread
-@opindex Wno-stringop-overread
-Warn for calls to string manipulation functions such as @code{memchr},
-@code{strcpy} that are determined to read past the end of the source
-sequence. 
-
-Option @option{-Wstringop-overread} is enabled by default.
-
 @table @gcctabopt
 @item -Wstringop-overflow
 @itemx -Wstringop-overflow=1
 @opindex Wstringop-overflow
 @opindex Wno-stringop-overflow
 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
-to determine the sizes of destination objects.  This is the default setting
-of the option.  At this setting the option does not warn for writes past
-the end of subobjects of larger objects accessed by pointers unless the
-size of the largest surrounding object is known.  When the destination may
-be one of several objects it is assumed to be the largest one of them.  On
-Linux systems, when optimization is enabled at this setting the option warns
-for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
-a non-zero value.
+to determine the sizes of destination objects.  At this setting the option
+does not warn for writes past the end of subobjects of larger objects accessed
+by pointers unless the size of the largest surrounding object is known.  When
+the destination may be one of several objects it is assumed to be the largest
+one of them.  On Linux systems, when optimization is enabled at this setting
+the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
+is defined to a non-zero value.
 
 @item -Wstringop-overflow=2
 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
 to determine the sizes of destination objects.  At this setting the option
-warna about overflows when writing to members of the largest complete
+warns about overflows when writing to members of the largest complete
 objects whose exact size is known.  However, it does not warn for excessive
 writes to the same members of unknown objects referenced by pointers since
-they may point to arrays containing unknown numbers of elements.
+they may point to arrays containing unknown numbers of elements.  This is
+the default setting of the option.
 
 @item -Wstringop-overflow=3
 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
@@ -6947,6 +6938,15 @@ whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
 setting of the option may result in warnings for benign code.
 @end table
 
+@item -Wno-stringop-overread
+@opindex Wstringop-overread
+@opindex Wno-stringop-overread
+Warn for calls to string manipulation functions such as @code{memchr}, or
+@code{strcpy} that are determined to read past the end of the source
+sequence.
+
+Option @option{-Wstringop-overread} is enabled by default.
+
 @item -Wno-stringop-truncation
 @opindex Wstringop-truncation
 @opindex Wno-stringop-truncation


More information about the Gcc-cvs mailing list