From: Francesco Potorti` <pot@gnu.org>
Subject: FIXNUM_OVERFLOW_P on amd64
Date: Mon, 04 Dec 2006 12:48:39 +0100 [thread overview]
Message-ID: <E1GrCJL-00025G-Mp@tucano.isti.cnr.it> (raw)
On gcc (GCC) 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
I get this:
gcc -c -D_BSD_SOURCE -Demacs -DHAVE_CONFIG_H -I. -I/home/pot/gnu/emacs-22.0.91/src -D_BSD_SOURCE -g -O2 -Wno-pointer-sign editfns.c
editfns.c: In function 'Fuser_uid':
editfns.c:1317: warning: comparison is always false due to limited range of data type
editfns.c:1317: warning: comparison is always false due to limited range of data type
The relevant line is:
return make_fixnum_or_float (geteuid ());
which expands to:
return (((long)(geteuid ()) > (((long) 1 << ((64 - 3) - 1)) - 1)
|| (long) (geteuid ()) < - ((long) 1 << ((64 - 3) - 1)))
? make_float (geteuid ())
: (((long) ((long)(geteuid ()))) << 3));
in lisp.h:
#define make_fixnum_or_float(val) \
(FIXNUM_OVERFLOW_P (val) \
? make_float (val) \
: make_number ((EMACS_INT)(val)))
#define FIXNUM_OVERFLOW_P(i) \
((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \
|| (EMACS_INT) (i) < MOST_NEGATIVE_FIXNUM)
#define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1)
So the problem apparently is that gcc realises that taking geteuid(),
stretching it to long and then comparing it with something bigger that
what geteuid() possibly can be is a no-op. This is what is intended, in
fact. To remove the warning, I tried to change the definition of
FIXNUM_OVERFLOW_P in lisp.h by adding a precondition like this:
#define FIXNUM_OVERFLOW_P(i) \
(sizeof(i) >= sizeof(EMACS_INT) \
&& ((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \
|| (EMACS_INT)(i) < MOST_NEGATIVE_FIXNUM))
But nothing changed: the warning is still there. While trying to find a
way to solve the problem, I realised that the make_fixnum_or_float is a
macro doing multiple evaluations of its argument, and editfns.c calls it
with a function call as an argument, which is generally not a good thing.
next reply other threads:[~2006-12-04 11:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-04 11:48 Francesco Potorti` [this message]
2006-12-04 15:01 ` FIXNUM_OVERFLOW_P on amd64 Stefan Monnier
2006-12-04 16:12 ` Francesco Potorti`
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1GrCJL-00025G-Mp@tucano.isti.cnr.it \
--to=pot@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.