Re: [PATCH] src/freeze.c (GET_NUMBER): Fix a typo.
Jim Meyering <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
Eric Blake <[email protected]> wrote: > According to Jim Meyering on 5/11/2008 7:00 AM: > | Thanks for humoring me ;-) > | Maybe the test suite never exercises this case? > > Actually, the master branch DOES exercise it. And it passed without your > patch, because... > > | } \ > | - if (((AllowNeg) ? INT_MIN: INT_MAX) < n \ > | + if (((AllowNeg) ? -INT_MIN : INT_MAX) < n \ > > ...n is unsigned. -INT_MIN == INT_MIN on 2's complement machines (and == > INT_MAX on 1's complement machines, if I remember correctly). But whether > the int on the left is INT_MIN or INT_MAX, upon conversion to unsigned for > comparison with n on the right, it should result in the correct unsigned > version of INT_MAX or (unsigned)INT_MAX + 1, depending on whether the > machine is 2's complement. I should have known better -- or just tried it. You have to admit it sure does *look* fishy.