emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: warnings compiling Emacs 22 on amd64


From: Stefan Monnier
Subject: Re: warnings compiling Emacs 22 on amd64
Date: Mon, 11 Dec 2006 17:52:44 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

> Are you talking about the comparison in FIXNUM_OVERFLOW_P?  If so,
> where's the 32-bit int and the 64-bit long in that macro?  I must be
> missing something, because what I see there is a comparison between
> two values which are both cast to EMACS_INT, which makes them both of
> type long.

If the argument i is of type int (32bit), then the compiler is sufficiently
clever to infer that the comparisons will always return the same value
(even though we cast that value to EMACS_INT (64bit) in between).

> If FIXNUM_OVERFLOW_P should always return zero on 64-bit machines,

It shouldn't.  There are a few sites where it does, tho.

> then how about changing FIXNUM_OVERFLOW_P so that it's a constant on
> 64-bit machines?  For example:

>   #ifdef _LP64
>   # define FIXNUM_OVERFLOW_P(i) 0
>   #else
>   # define FIXNUM_OVERFLOW_P(i) \
>      ((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \
>       || (EMACS_INT) (i) < MOST_NEGATIVE_FIXNUM)
>   #endif

> Does this fix the problem?

What problem?  There is no problem other than unhelpful warnings.
The warnings basically say "hey guys, I found an optimization opportunity"
and we're very happy that gcc does the optimization: it saves us from trying
to write ugly and brittle code such as the one above.  Too bad gcc is a bit
noisy in this case.  We can probably remove those warnings with the
right -Wno-foo invocation.

> (But I still would like to understand why the comparison is always
> true.)

It's only "always true" in some specific contexts.


        Stefan




reply via email to

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