mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fix byte-compilation of (+ -0.0) (bug#42597)
* lisp/emacs-lisp/bytecomp.el (byte-compile-associative): Translate numerical identity expressions, such as (+ x) and (* x), into (* x 1) since the previous translation (+ x 0) gets it wrong for x = -0.0. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test cases.
This commit is contained in:
parent
b83f274869
commit
204273c3b9
2 changed files with 8 additions and 3 deletions
|
|
@ -3733,7 +3733,7 @@ discarding."
|
|||
;; Compile a function that accepts one or more args and is right-associative.
|
||||
;; We do it by left-associativity so that the operations
|
||||
;; are done in the same order as in interpreted code.
|
||||
;; We treat the one-arg case, as in (+ x), like (+ x 0).
|
||||
;; We treat the one-arg case, as in (+ x), like (* x 1).
|
||||
;; in order to convert markers to numbers, and trigger expected errors.
|
||||
(defun byte-compile-associative (form)
|
||||
(if (cdr form)
|
||||
|
|
@ -3748,8 +3748,8 @@ discarding."
|
|||
(setq args (copy-sequence (cdr form)))
|
||||
(byte-compile-form (car args))
|
||||
(setq args (cdr args))
|
||||
(or args (setq args '(0)
|
||||
opcode (get '+ 'byte-opcode)))
|
||||
(or args (setq args '(1)
|
||||
opcode (get '* 'byte-opcode)))
|
||||
(dolist (arg args)
|
||||
(byte-compile-form arg)
|
||||
(byte-compile-out opcode 0))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue