On 08/06/2017 02:07 PM, Martin Sebor wrote:
>>>
>>> You're right that there is no truncation and the effect is
>>> the same but only in the unlikely case when the destination
>>> is empty. Otherwise the result is truncated.
>> Maybe this is where I'm confused. How does the destination play into
On 08/02/2017 10:58 AM, Jeff Law wrote:
On 07/31/2017 01:42 PM, Martin Sebor wrote:
So I *think* TYPE_SIZE_UNIT isn't necessarily guaranteed to be a
INTEGER_CST, it could be a non-constant expression for the size. Are
the callers of compute_objsize prepared to handle that? Just to be
clear,
On 07/31/2017 01:42 PM, Martin Sebor wrote:
>> So I *think* TYPE_SIZE_UNIT isn't necessarily guaranteed to be a
>> INTEGER_CST, it could be a non-constant expression for the size. Are
>> the callers of compute_objsize prepared to handle that? Just to be
>> clear, I'd prefer to return
So I think the fixes exposed by the new warning are OK to go in as-is
immediately if you wish to do so. Minor questions on the actual
improved warnings inline.
Sure, thanks.
-static inline tree
+static tree
compute_objsize (tree dest, int ostype)
{
...
+ type = TYPE_MAIN_VARIANT
On 07/08/2017 02:45 PM, Martin Sebor wrote:
> PR 81117 asks for improved detection of common misuses(*) of
> strncpy and strncat. The attached patch is my solution. It
> consists of three related sets of changes:
>
> 1) Adds a new option, -Wstringop-truncation, that diagnoses calls
> to