opensubscriber
   Find in this group all groups
 
Unknown more information…

m : m4-patches@gnu.org 30 April 2011 • 9:18PM -0400

Re: [SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.16-3-gfb132bf
by Eric Blake

REPLY TO AUTHOR
 
REPLY TO GROUP




On 04/30/2011 01:16 AM, Gary V. Vaughan wrote:
> Hi Eric,
>
>>    
>>     argc is an int, therefore by definition, it is <= INT_MAX.
>>    
>> -  assert (0 < argc && argc <= INT_MAX);
>> +  assert (0 < argc);
>>    for (i = 1; i < (unsigned) argc; i++)
>>      {
>>        const char *arg = ARG((int) i);
>
> Since argc is immediately cast to an unsigned int, I think the test was
> supposed to be:
>
>   assert (0 < argc && argc <= UINT_MAX);

Except that INT_MAX  < UINT_MAX, so that's also redundant.  The real
trick was that gcc was issuing spurious warnings if it didn't have proof
that argc was positive, so all we really needed was the (0 < argc) term;
my mistake in the earlier patch was adding a redundant term at the same
time.

--
Eric Blake   eblake@redh...    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.