[PATCH] improve out-of-bounds pointer warning (PR 88771)

Richard Biener richard.guenther@gmail.com
Fri Feb 8 09:11:00 GMT 2019


On Thu, Feb 7, 2019 at 2:14 AM Martin Sebor <msebor@gmail.com> wrote:
>
> The attached patch doesn't avoid the false positive but only improves
> the warning to make it more readable (as suggested in the PR by Richard
> for GCC 9).  With the patch, for a call like:
>
>    memcpy (d, s, -1);
>
> where d and s are pointers with unknown provenances the patch has GCC
> in LP32 issue
>
>    warning: ‘memcpy’ specified bound 4294967295 exceeds maximum object
> size 2147483647 [-Wstringop-overflow=]
>
> instead of the somewhat mystifying
>
>    ‘memcpy’ pointer overflow between offset 0 and size [4294967295,
> 2147483647] [-Warray-bounds]
>
> There are a few places the warning is issued from and it would make
> sense to consolidate them into the same utility function.  Since that
> will require some not entirely trivial changes to the warning code
> I defer it until GCC 10 as well, along with a fix for the false
> positive.
>
> Tested on x86_64-linux.

OK.

> Martin



More information about the Gcc-patches mailing list