GNU bug report logs - #34757
Invalid bytecode from byte compiler

Previous Next

Package: emacs;

Reported by: chuntaro <chuntaro <at> sakura-games.jp>

Date: Tue, 5 Mar 2019 15:30:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#34757: closed (Invalid bytecode from byte compiler)
Date: Sat, 27 Jul 2019 21:31:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 27 Jul 2019 17:30:03 -0400
with message-id <jwvtvb7maio.fsf-monnier+emacs <at> gnu.org>
and subject line Re: bug#34757: Invalid bytecode from byte compiler
has caused the debbugs.gnu.org bug report #34757,
regarding Invalid bytecode from byte compiler
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
34757: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34757
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: chuntaro <chuntaro <at> sakura-games.jp>
To: bug-gnu-emacs <at> gnu.org
Subject: Invalid bytecode from byte compiler
Date: Tue, 5 Mar 2019 17:01:00 +0900
Invalid bytecode is output and error occurs when executed.

Byte compile the following code.

bug.el
----------------------------------------------------------------
;;; -*- lexical-binding: t; -*-

(let ((a 2))
  (print 1)
  (setq a 1))
----------------------------------------------------------------

$ emacs --batch -f batch-byte-compile bug.el

bug.elc
----------------------------------------------------------------
;ELC
...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(funcall 2 'print 1)
1
----------------------------------------------------------------

$ emacs --batch -l bug.elc
Invalid function: 2

It occurs in versions 25.2, 26.1 and HEAD.


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Pip Cet <pipcet <at> gmail.com>
Cc: 34757-done <at> debbugs.gnu.org, chuntaro <chuntaro <at> sakura-games.jp>
Subject: Re: bug#34757: Invalid bytecode from byte compiler
Date: Sat, 27 Jul 2019 17:30:03 -0400
> We could fix byte-compile-out-toplevel to properly analyze how many
> stack arguments the call takes, but this patch simply treats forms
> like this as nontrivial:
>
> diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
> index 0b8f8824b4c..4e54e08ce14 100644
> --- a/lisp/emacs-lisp/bytecomp.el
> +++ b/lisp/emacs-lisp/bytecomp.el
> @@ -3025,6 +3025,7 @@ byte-compile-out-toplevel
>                         (or (null (cdr rest))
>                             (and (memq output-type '(file progn t))
>                                  (cdr (cdr rest))
> +                                (eql (length body) (cdr (car rest)))
>                                  (eq (car (nth 1 rest)) 'byte-discard)
>                                  (progn (setq rest (cdr rest)) t))))
>                    (setq maycall nil)    ; Only allow one real function call.

I installed this fix for now.


        Stefan



This bug report was last modified 5 years and 297 days ago.

Previous Next


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