[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7928: mktime test in configure: UB resulting in infinite loop
From: |
Paul Eggert |
Subject: |
bug#7928: mktime test in configure: UB resulting in infinite loop |
Date: |
Thu, 27 Jan 2011 09:57:06 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
On 01/27/11 09:28, Rich Felker wrote:
> On Thu, Jan 27, 2011 at 08:14:56AM -0700, Eric Blake wrote:
>> > # define TYPE_MINIMUM(t) \
>> > ((t) (! TYPE_SIGNED (t) \
>> > ? (t) 0 \
>> > : TYPE_SIGNED_MAGNITUDE (t) \
>> > ? ~ (t) 0 \
>> > : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
>> > # define TYPE_MAXIMUM(t) \
>> > ((t) (! TYPE_SIGNED (t) \
>> > ? (t) -1 \
>> > : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
> The last line of this macro has UB due to signed integer overflow in
> the << operation.
No it doesn't. ~ (t) 0 evaluates to -1, and -1 << 31 does not
overflow.
- bug#7928: mktime test in configure: UB resulting in infinite loop, Rich Felker, 2011/01/27
- bug#7928: mktime test in configure: UB resulting in infinite loop, Eric Blake, 2011/01/27
- bug#7928: mktime test in configure: UB resulting in infinite loop, Bruno Haible, 2011/01/27
- bug#7928: mktime test in configure: UB resulting in infinite loop, Rich Felker, 2011/01/28
- bug#7928: mktime test in configure: UB resulting in infinite loop, Paul Eggert, 2011/01/28
- bug#7928: mktime test in configure: UB resulting in infinite loop, Rich Felker, 2011/01/28
- bug#7928: mktime test in configure: UB resulting in infinite loop, Bruno Haible, 2011/01/28
- bug#7928: mktime test in configure: UB resulting in infinite loop, Rich Felker, 2011/01/28
- bug#7928: mktime test in configure: UB resulting in infinite loop, Paul Eggert, 2011/01/30