[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?
From: |
Stefan Monnier |
Subject: |
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ? |
Date: |
Fri, 23 Oct 2009 21:05:05 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
>>>>> "Eli" == Eli Zaretskii <address@hidden> writes:
>> From: Andreas Schwab <address@hidden>
>> Date: Fri, 23 Oct 2009 22:57:07 +0200
>> Cc: address@hidden
>>
>> > #define FIXNUM_OVERFLOW_P(i) \
>> > ((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \
>> > || (EMACS_INT) (i) < MOST_NEGATIVE_FIXNUM)
>> >
>> > I think FIXNUM_OVERFLOW_P is problematic.
>>
>> Thanks for the report. The right fix is to remove the cast, so that the
>> compiler will promote the operands to the appropriate common type.
> I think removing the cast will cause the compiler to whine on 64-bit
> platforms about comparison being always right or wrong when the
> argument is narrower than a 64-bit long. IIRC, that's why the cast
> was introduced in the first place.
Actually, when the cast was added in 2001, it came with the following
commit-log-comment:
(FIXNUM_OVERFLOW_P): Cast I to EMACS_INT in comparisons
in case I is of some unsigned type, in which case
MOST_NEGATIVE_FIXNUM will be converted to unsigned, and the
comparison becomes bogus.
-- Stefan
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, (continued)
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Andreas Schwab, 2009/10/24
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Stefan Monnier, 2009/10/24
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Toru TSUNEYOSHI, 2009/10/26
- Message not available
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Toru TSUNEYOSHI, 2009/10/24
- Message not available
- Message not available
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Toru TSUNEYOSHI, 2009/10/24
- Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Eli Zaretskii, 2009/10/24
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Andreas Schwab, 2009/10/23
Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?, Stefan Monnier, 2009/10/23