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

Martin Sebor msebor@gmail.com
Wed Jan 22 21:27:00 GMT 2020


On 1/22/20 9:35 PM, Jeff Law wrote:
> 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.

That was PR 92666, an unrelated C++ bug fixed recently by Jakub.
This time, my bootstrap of this patch went fine.

Martin



More information about the Gcc-patches mailing list