GNU bug report logs - #32477
27.0.50; `=` burps on bignums when compiled

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Date: Sun, 19 Aug 2018 23:16:02 UTC

Severity: normal

Merged with 32486

Found in version 27.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pip Cet <pipcet <at> gmail.com>
To: andrewjmoreton <at> gmail.com
Cc: 32477 <at> debbugs.gnu.org
Subject: bug#32477: 27.0.50; `=` burps on bignums when compiled
Date: Mon, 20 Aug 2018 20:44:18 +0000
On Mon, Aug 20, 2018 at 1:38 AM Andy Moreton <andrewjmoreton <at> gmail.com> wrote:
> On Sun 19 Aug 2018, Stefan Monnier wrote:
>
> > Package: Emacs
> > Version: 27.0.50
> >
> > If you try
> >
> >     M-: (funcall (lambda (x) (= x x)) (expt 2 64)) RET
> >
> > you'll unsurprisingly get t as result.  Yay!  But if you try
> >
> >     M-: (funcall (byte-compile '(lambda (x) (= x x))) (expt 2 64)) RET
> >
> > you should be prompted with an error stating that this largish number is
> > not a number-or-marker.  This error occurs for example when loading
> > elpa/packages/xelb/xcb-types.elc.
>
> I can reproduce this on a 64bit build on Windows. The following lightly
> tested patch appears to work:
>
> diff --git a/src/bytecode.c b/src/bytecode.c
> index b27fa7c5c6..155f714a56 100644
> --- a/src/bytecode.c
> +++ b/src/bytecode.c
> @@ -990,8 +990,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
>               TOP = arithcompare (v1, v2, ARITH_EQUAL);
>             else
>               {
> -               CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER (v1);
> -               CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER (v2);
> +               CHECK_INTEGER_COERCE_MARKER (v1);
> +               CHECK_INTEGER_COERCE_MARKER (v2);
>                 TOP = EQ (v1, v2) ? Qt : Qnil;
>               }
>             NEXT;
>

(funcall (byte-compile '(lambda (x y) (= (expt 2 x) (expt 2 y)))) 64 64)

returns nil with this patch: we want `eql', not `eq'.

(I think we should simply call arithcompare in all cases, but we can
add a FIXNUMP (v1) && FIXNUMP (v2) condition, too).




This bug report was last modified 6 years and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.