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

Eric Blake <[email protected]> Sat, 30 Apr 2011 07:18:49 -0600
Newsgroups gmane.comp.gnu.m4.patches
Organization Red Hat
Message-ID <[email protected]>
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   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

_______________________________________________
M4-patches mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/m4-patches
signature.asc (application/pgp-signature, 619 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJNvAw5AAoJEKeha0olJ0NqVEsH/jM2MwthaRlXFxDfphyDluPf
yC4s5zVP/bwHmDTz9f33UVKMb4gLnsVt6f7oGTeVGc9zNvXyHFZAtd7g+4FMgXVr
tLZwRbdao+g1xkqv2YphOQ0O/7JPgQ6eqW+x43IsAWXM4ZZ6U4XWdkaC1dzJPaZ5
M3+5gMo/vfKlJIC1qoq9h3NfaB88EIIbOZMLwVXPAln3IYx4+MDAPdiHa+1CQp9J
OLkYSQUjweGiThC4WxGxfdpZag4ZJIN1V0IvOKnyACDP0caLOA7sbKVKvgJOmeVB
ei85A4mjZyUrtZT6MgwDA+cHEZ0sP94JmUuDWNC+6M8MDyf+qZKy4DvLnIctPts=
=D9oE
-----END PGP SIGNATURE-----