lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Integer overflow warnings in bourn_cast with clang


From: Greg Chicares
Subject: Re: [lmi] Integer overflow warnings in bourn_cast with clang
Date: Thu, 13 Apr 2017 11:05:16 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 2017-04-13 01:10, Greg Chicares wrote:
> On 2017-04-06 15:24, Greg Chicares wrote:
>> On 2017-04-06 00:24, Vadim Zeitlin wrote:
> [...]
>>>  Still, it does seem wrong to add 1 to the maximally representable value of
>>> type "To" without being certain that it is _strictly_ less than that of
>>> type "From".
> 
> Thanks for exposing that tacit assumption. Like other comparisons in
> this code, this one is problematic. We could add one and then test
> whether we exceeded the limit--but if that exceeds the limit, then
> adding one was UB, so the test is invalid. Yet subtracting one from
> the limit might have no effect, and a value that is strictly greater
> might compare equal. Instead, I worked with some of the less commonly
> used members of std::numeric_limits in commit 63a32a8.

Not 63a32a8, but rather 204bd5f.




reply via email to

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