[PATCH] suppress -Wstringop-overflow when no-warning is set (PR 83508)

Martin Sebor msebor@gmail.com
Wed Jan 10 20:27:00 GMT 2018


To avoid issuing duplicate warnings for the same function call
in the source code the -Wrestrict warning code makes sure
the no-warning bit is propagated between trees and GIMPLE and
tested before issuing a warning.  But the warning also detects
some of the same problems as -Wstringop-overflow, and that
warning was not updated to pay attention to the no-warning bit.
This can in turn lead to two warnings for what boils down to
the same bug.  The warnings can be confusing when the first
one references the function as it appears in the source code
and the second one the one it was transformed to by GCC after
the first warning was issued.

The attached patch corrects this oversight by having
the buffer overflow checker test the no-warning bit and skip
issuing a diagnostic.  (The function that does the overflow
checking still runs so that it can continue to indicate to its
callers whether an overflow has been detected.)

Bootstrap on x86_64-linux in progress.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-83508.diff
Type: text/x-patch
Size: 2903 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180110/9f81cfb4/attachment.bin>


More information about the Gcc-patches mailing list