On 10/2/19 5:15 PM, Martin Sebor wrote:
> The attached patch adds an optional argument to
> compute_builtin_object_size to let it return the DECL of the object
> whose size it's called to compute.  This lets -Wstringop-overflow
> point to the object in more instances of the warning than it does
> now (but by no means all of them -- more work is needed to make
> that happen).  This can be helpful when the object is declared in
> a different function than the access.
> 
> Tested on x86_64-linux.
> 
> Martin
> 
> 
> gcc-objsize-loc.diff
> 
> gcc/ChangeLog:
> 
>       * builtins.c (compute_objsize): Add an argument.
>       * tree-object-size.c (addr_object_size): Same.
>       (compute_builtin_object_size): Same.
>       * tree-object-size.h (compute_builtin_object): Same.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.dg/Wstringop-overflow-17.c: New test.
OK
jeff

Reply via email to