[PATCH] avoid -Wrestrict on sprintf %p with destination as argument (PR 84919)

Jeff Law law@redhat.com
Wed Jan 22 20:44:00 GMT 2020


On Wed, 2020-01-22 at 15:59 +0100, Martin Sebor wrote:
> The early front-end only implementation of -Wrestrict that's still
> present in GCC 10 issues a false postive for %p arguments that are
> the same as the destination.  Bug 84919 reports an instance of this
> false positive in the Linux kernel.
> 
> That attached patch suppresses the front-end warning for the sprintf
> family of functions, letting the sprintf pass that was in GCC 10
> extended to also handle -Wrestrict for these functions, handle
> them instead.
> 
> Tested on x86_64-linux.
> 
> Since this is a regression I'd like to commit the fix to GCC 10.
In the BZ your comment indicates that it trips another bogus warning
during bootstrap.  Presumably you already fixed that?  If so, OK.

jeff



More information about the Gcc-patches mailing list