bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] src/sort.c: pipe_fork is always called with tries > 0


From: Kovarththanan Rajaratnam
Subject: Re: [PATCH] src/sort.c: pipe_fork is always called with tries > 0
Date: Wed, 06 Jan 2010 17:13:28 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Jim Meyering wrote:
> Kovarththanan Rajaratnam wrote:
>> clang detected the following false positive:
>>
>> sort.c:906:11: warning: The left operand of '<' is a garbage value
>>   if (pid < 0)
>>       ~~~ ^
>>
>> src/sort.c: Add an assert indicating that pipe_fork is always called with 
>> tries > 0. This allows clang to deduce that 'pid' will always be set/is 
>> valid.
> 
> Thank you for all of the patches.
> I too would like to address all of clang's warnings about
> coreutils, but it seems like clang is not quite mature enough
> for me to be comfortable adding the many assertions required
> to quiet its false positive warnings.

Sadly, clang doesn't yet support interprocedural analysis, so it doesn't
reason about how the functions are called/used (which would have avoided
this particular false positive).

> 
> Is there any other way to make clang understand that no warning is
> required here?
> 

Sadly, no. It sounds as though you might be open to annotations (similar
to splint?) or am I getting the wrong message here?

-- 
Best regards,
Kovarththanan Rajaratnam




reply via email to

[Prev in Thread] Current Thread [Next in Thread]