Subject: Re: bug#5754: Bytecomp Arithmetic test failed

From: Juri Linkov <[email-masked]>
Date: Thu, 25 Mar 2010 09:19:11 +0200

> I tried to run some tests in the `test' subdir,
> and `bytecomp-testsuite-run' in `test/bytecomp-testsuite.el' fails
> on one test: (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))
> returns 5e-324 when evaluated by interpreter,
> but after byte-compilation returns 0.0

This bug is caused by optimization in byte-compilation
that changes the order of function arguments.

It byte-compiles

  (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))

to

0	constant  expt
1	constant  2
2	constant  -1074
3	call	  2
4	constant  0.125
5	varbind	  b
6	varbind	  a
7	constant  *
8	varref	  a
9	varref	  b
10	constant  8
11	call	  3
12	unbind	  2
13	return

where the order of arguments 8-10 is changed from (* a 8 b) to (* a b 8)

For this test the different order of arguments changes
the returned value:

(funcall '* 5e-324 8 0.125)
=> 5e-324

(funcall '* 5e-324 0.125 8)
=> 0.0

-- 
Juri Linkov
http://www.jurta.org/emacs/