GNU bug report logs - #14565
24.3.50; Error with byte-compiled function using backward-char

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Thu, 6 Jun 2013 14:27:01 UTC

Severity: normal

Found in version 24.3.50

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stephen Berman <stephen.berman <at> gmx.net>
To: 14565 <at> debbugs.gnu.org
Subject: bug#14565: 24.3.50; Error with byte-compiled function using backward-char
Date: Thu, 06 Jun 2013 20:30:41 +0200
On Thu, 06 Jun 2013 16:24:17 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> When I evaluate and invoke each of the following functions, they both
> work as expected:
>
> (defun my-test-1 () (forward-char nil))
>
> (defun my-test-2 () (backward-char nil))
>
> But if I byte-compile them, only my-test-1 works; my-test-2 raises a
> Lisp error: (wrong-type-argument number-or-marker-p nil)
>
> Here are the byte codes:
>
> (byte-code "\300\301\302\"\207" [defalias my-test-1 #[nil "\300u\207" [nil] 1]] 3)
>
> (byte-code "\300\301\302\"\207" [defalias my-test-2 #[nil "\300[u\207" [nil] 1]] 3)
>
> and here is the disassembled code:
>
> byte code for my-test-1:
>   args: nil
> 0	constant  nil
> 1	forward-char 
> 2	return	  
>
> byte code for my-test-2:
>   args: nil
> 0	constant  nil
> 1	negate	  
> 2	forward-char 
> 3	return	  

If `negate' in the byte code corresponds to the case Bnegate in
exec_byte_code, then IIUC nil fails the test for INTEGERP so is passed
to Fminus, and from there to arith_driver, where it fails
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER, which via CHECK_TYPE signals the
wrong-type-argument error.  If this is what happens, then the byte code
of backward-char is at odds with its definition via move_point in
cmds.c, which explicitly checks whether the argument is nil, and if so
sets it to 1, which for Fbackward_char is then negated.  Or have I
completely misunderstood and if so, what is the error due to?

Steve Berman




This bug report was last modified 11 years and 349 days ago.

Previous Next


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