Re: False positive and false negative from -Wformat-truncation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/16/2017 11:45 AM, Martin Sebor wrote:
> On 10/16/2017 06:28 AM, Mason wrote:
>> Hello,
>>
>> I do note that the documentation for -Wformat-truncation states:
>> "While enabling optimization will in most cases improve the accuracy
>> of the warning, it may also result in false positives."
>>
>>
>> However, consider the following test cases:
> 
> The implementation of the warning uses the get_range_info() function
> to determine the range of sprintf arguments and its ability to avoid
> false positives and negatives is subject to the accuracy of the range
> information made available by this API.  (See the output of
> -fdump-tree-printf-return-value for the ranges the warning pass
> sees, and the bugs in Bugzilla tracking these issues.)  This is
> a general problem that affects all clients of the get_range_info()
> function.
One of the things I was playing with last week was separating the EVRP
analysis from optimization.

In that proof of concept code you would be able to build up context
specific range information during a dominator walk -- and if you issue a
range query during that dominator walk you'll get that range specific data.

It doesn't solve all the problems we're looking to resolve with Andrew's
work, but I think it'll make it easier to plug in Andrew's work later
*and* can be used to improve the accuracy of warnings today.

Right now the separation is a big ugly and it relies on still having
access to bits within tree-vrp.c, but I can probably hack around those
limitations to see if it would resolve this specific instance.  If so,
it might be worth picking up to see if we can push it forward.

jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux