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

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

bug#32477: 27.0.50; `=` burps on bignums when compiled


From: Pip Cet
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 <address@hidden> 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).





reply via email to

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