GNU bug report logs - #5754
Bytecomp Arithmetic test failed

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 23 Mar 2010 07:52:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5754 in the body.
You can then email your comments to 5754 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Tue, 23 Mar 2010 07:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 23 Mar 2010 07:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Bytecomp Arithmetic test failed
Date: Tue, 23 Mar 2010 09:47:59 +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

In GNU Emacs 24.0.50 (x86_64-pc-linux-gnu) of 2010-03-23
Windowing system distributor `The X.Org Foundation', version 11.0.10400090
configured using `configure  '--with-x-toolkit=no'
'CFLAGS=-g3 -O0 -Wno-pointer-sign -fno-inline -fno-crossjumping''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: en_DK.utf8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=SCIM
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

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





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Tue, 23 Mar 2010 08:40:02 GMT) Full text and rfc822 format available.

Message #8 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Tue, 23 Mar 2010 09:38:38 +0100
On Tue, Mar 23, 2010 at 8:47 AM, Juri Linkov <juri <at> jurta.org> wrote:
> I tried to run some tests in the `test' subdir,

Should not these tests be run automatically when building Emacs?

> 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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Tue, 23 Mar 2010 09:05:01 GMT) Full text and rfc822 format available.

Message #11 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Tue, 23 Mar 2010 11:03:35 +0200
>> I tried to run some tests in the `test' subdir,
>
> Should not these tests be run automatically when building Emacs?

Not when building Emacs, but there should be a make target like
`make test'.  And when choosing a unit test framework to add to Emacs,
the main criteria should be the ability to run tests in batch mode.

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Tue, 23 Mar 2010 13:33:02 GMT) Full text and rfc822 format available.

Message #14 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Tue, 23 Mar 2010 14:31:42 +0100
On Tue, Mar 23, 2010 at 10:03 AM, Juri Linkov <juri <at> jurta.org> wrote:
>>> I tried to run some tests in the `test' subdir,
>>
>> Should not these tests be run automatically when building Emacs?
>
> Not when building Emacs, but there should be a make target like
> `make test'.  And when choosing a unit test framework to add to Emacs,
> the main criteria should be the ability to run tests in batch mode.


(Sorry for taking up the question here, but I hope it is not forgotten.)

Yes, there should such a target. But why don't you think it would be
run at the end of the build process?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Wed, 24 Mar 2010 22:17:02 GMT) Full text and rfc822 format available.

Message #17 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: Juri Linkov <juri <at> jurta.org>, 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Wed, 24 Mar 2010 18:15:41 -0400
Lennart Borgman <lennart.borgman <at> gmail.com> writes:

>> Not when building Emacs, but there should be a make target like
>> `make test'.  And when choosing a unit test framework to add to Emacs,
>> the main criteria should be the ability to run tests in batch mode.
>
> Yes, there should such a target. But why don't you think it would be
> run at the end of the build process?

No, thanks.  It would be a nuisance for developers.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Wed, 24 Mar 2010 22:53:02 GMT) Full text and rfc822 format available.

Message #20 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Juri Linkov <juri <at> jurta.org>, 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Wed, 24 Mar 2010 23:52:29 +0100
On Wed, Mar 24, 2010 at 11:15 PM, Chong Yidong <cyd <at> stupidchicken.com> wrote:
> Lennart Borgman <lennart.borgman <at> gmail.com> writes:
>
>>> Not when building Emacs, but there should be a make target like
>>> `make test'.  And when choosing a unit test framework to add to Emacs,
>>> the main criteria should be the ability to run tests in batch mode.
>>
>> Yes, there should such a target. But why don't you think it would be
>> run at the end of the build process?
>
> No, thanks.  It would be a nuisance for developers.


In what way?

The idea behind unit tests is to catch errors as soon as possible
after each change. Would not running the unit tests directly after
building help with that? Some problems are platform specific and will
perhaps show up during unit tests.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Thu, 25 Mar 2010 01:17:02 GMT) Full text and rfc822 format available.

Message #23 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Wed, 24 Mar 2010 21:15:57 -0400
>>>> Not when building Emacs, but there should be a make target like
>>>> `make test'.  And when choosing a unit test framework to add to Emacs,
>>>> the main criteria should be the ability to run tests in batch mode.
>>> Yes, there should such a target. But why don't you think it would be
>>> run at the end of the build process?
>> No, thanks.  It would be a nuisance for developers.
> In what way?
> The idea behind unit tests is to catch errors as soon as possible
> after each change. Would not running the unit tests directly after
> building help with that? Some problems are platform specific and will
> perhaps show up during unit tests.

It could only work if running the test takes a negligible amount of
time, and it generates almost no output if all goes well.
The second point is probably easy, but the first is unlikely to stay
true for long.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Thu, 25 Mar 2010 01:21:01 GMT) Full text and rfc822 format available.

Message #26 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Thu, 25 Mar 2010 02:19:49 +0100
On Thu, Mar 25, 2010 at 2:15 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>>>>> Not when building Emacs, but there should be a make target like
>>>>> `make test'.  And when choosing a unit test framework to add to Emacs,
>>>>> the main criteria should be the ability to run tests in batch mode.
>>>> Yes, there should such a target. But why don't you think it would be
>>>> run at the end of the build process?
>>> No, thanks.  It would be a nuisance for developers.
>> In what way?
>> The idea behind unit tests is to catch errors as soon as possible
>> after each change. Would not running the unit tests directly after
>> building help with that? Some problems are platform specific and will
>> perhaps show up during unit tests.
>
> It could only work if running the test takes a negligible amount of
> time, and it generates almost no output if all goes well.

Or if fail is noticeable.

> The second point is probably easy, but the first is unlikely to stay
> true for long.

Why not try it and remove it if it becomes a burden?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Thu, 25 Mar 2010 07:26:02 GMT) Full text and rfc822 format available.

Message #29 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
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/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Tue, 30 Mar 2010 16:21:02 GMT) Full text and rfc822 format available.

Message #32 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: 5754 <at> debbugs.gnu.org
Cc: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Tue, 30 Mar 2010 19:08:45 +0300
I see that this was extensively discussed in bug#1334,
so I Cc:ed Shigeru Fukaya.  Shigeru, are you interested in
looking at the test failure reported by bytecomp-testsuite.el?

>> 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
>>
>> In GNU Emacs 24.0.50 (x86_64-pc-linux-gnu) of 2010-03-23
>
> 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/




Severity set to 'serious' from 'normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 03 Apr 2010 00:12:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Sat, 03 Apr 2010 22:23:01 GMT) Full text and rfc822 format available.

Message #37 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Sun, 04 Apr 2010 01:18:17 +0300
> 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

`byte-optimize-plus' and `byte-optimize-minus' avoid this problem
by not using `byte-optimize-delay-constants-math' (see how its call
is commented out in `byte-opt.el').  Maybe `byte-optimize-multiply'
and `byte-optimize-divide' should do the same?

=== modified file 'lisp/emacs-lisp/byte-opt.el'
--- lisp/emacs-lisp/byte-opt.el	2010-01-13 08:35:10 +0000
+++ lisp/emacs-lisp/byte-opt.el	2010-04-03 22:16:20 +0000
@@ -806,7 +806,8 @@ (defun byte-optimize-minus (form)
   (byte-optimize-predicate form))
 
 (defun byte-optimize-multiply (form)
-  (setq form (byte-optimize-delay-constants-math form 1 '*))
+  ;; Don't call `byte-optimize-delay-constants-math' (bug#1334, bug#5754).
+  ;; (setq form (byte-optimize-delay-constants-math form 1 '*))
   ;; For (* constants..), byte-optimize-predicate does the work.
   (when (memq nil (mapcar 'numberp (cdr form)))
     ;; After `byte-optimize-predicate', if there is a INTEGER constant
@@ -823,7 +824,8 @@ (defun byte-optimize-multiply (form)
   (byte-optimize-predicate form))
 
 (defun byte-optimize-divide (form)
-  (setq form (byte-optimize-delay-constants-math form 2 '*))
+  ;; Don't call `byte-optimize-delay-constants-math' (bug#1334, bug#5754).
+  ;; (setq form (byte-optimize-delay-constants-math form 2 '*))
   ;; After `byte-optimize-predicate', if there is a INTEGER constant
   ;; in FORM, it is in the last element.
   (let ((last (car (reverse (cdr (cdr form))))))

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Sat, 03 Apr 2010 22:42:02 GMT) Full text and rfc822 format available.

Message #40 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 5754 <at> debbugs.gnu.org
Subject: Re: Bytecomp Arithmetic test failed
Date: Sat, 03 Apr 2010 18:40:59 -0400
> 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

I originally thought this was a regression, because my copy of Emacs
23.1 did not appear to have this problem.  On further investigation, it
is not a regression.  Emacs 23.1 and before also have the problem.

The key is that if I compile Emacs with CFLAGS="-g", then

(funcall
 (byte-compile
  (list 'lambda nil
	(quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))

returns 0.0.  If I compile Emacs with CFLAGS="-g -O2", then it returns
5e-324.

It looks like this may be a compiler bug.




Severity set to 'normal' from 'serious' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 03 Apr 2010 22:42:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Sat, 03 Apr 2010 23:09:01 GMT) Full text and rfc822 format available.

Message #45 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 5754 <at> debbugs.gnu.org
Subject: Re: Bytecomp Arithmetic test failed
Date: Sun, 04 Apr 2010 01:54:50 +0300
> I originally thought this was a regression, because my copy of Emacs
> 23.1 did not appear to have this problem.  On further investigation, it
> is not a regression.  Emacs 23.1 and before also have the problem.
>
> The key is that if I compile Emacs with CFLAGS="-g", then
>
> (funcall
>  (byte-compile
>   (list 'lambda nil
> 	(quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))
>
> returns 0.0.  If I compile Emacs with CFLAGS="-g -O2", then it returns
> 5e-324.

Does (let ((a (expt 2 -1074)) (b 0.125)) (* a b 8))
return 5e-324 when you compile with CFLAGS="-g -O2"?

Note the constant 8 at the end, this form is what actually
executed after byte-compilation with optimization.

I guess if

(funcall
 (byte-compile
  (list 'lambda nil
	(quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))

returns 5e-324 with CFLAGS="-g -O2",
then

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

returns 5e-324 as well?

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Sat, 03 Apr 2010 23:33:02 GMT) Full text and rfc822 format available.

Message #48 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 5754 <at> debbugs.gnu.org
Subject: Re: Bytecomp Arithmetic test failed
Date: Sat, 03 Apr 2010 19:31:57 -0400
Juri Linkov <juri <at> jurta.org> writes:

> Does (let ((a (expt 2 -1074)) (b 0.125)) (* a b 8))
> return 5e-324 when you compile with CFLAGS="-g -O2"?

With CFLAGS="-g -O2",

  (let ((a (expt 2 -1074)) (b 0.125)) (* a b 8))
     => 5e-24

  (eval '(let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b)))
     => 5e-324

  (funcall (byte-compile
    (list 'lambda nil
      (quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))
     => 5e-24

With CFLAGS="-g",

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

  (eval '(let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b)))
     => 5e-324

  (funcall (byte-compile
    (list 'lambda nil
      (quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))
     => 0.0

The latter two are what cause bytecomp-testsuite to fail.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Sun, 04 Apr 2010 06:27:02 GMT) Full text and rfc822 format available.

Message #51 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: juri <at> jurta.org, 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Sun, 04 Apr 2010 09:25:10 +0300
> From: Chong Yidong <cyd <at> stupidchicken.com>
> Date: Sat, 03 Apr 2010 18:40:59 -0400
> Cc: 5754 <at> debbugs.gnu.org
> 
> The key is that if I compile Emacs with CFLAGS="-g", then
> 
> (funcall
>  (byte-compile
>   (list 'lambda nil
> 	(quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))
> 
> returns 0.0.  If I compile Emacs with CFLAGS="-g -O2", then it returns
> 5e-324.
> 
> It looks like this may be a compiler bug.

I doubt it.  I see this in GCC 3.4.x; the chances that two very
different versions have the same bug are less than slim, I think.

I'd suspect some bug in our code, before considering a GCC bug.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5754; Package emacs. (Sun, 04 Apr 2010 08:06:02 GMT) Full text and rfc822 format available.

Message #54 received at 5754 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Juri Linkov <juri <at> jurta.org>, 5754 <at> debbugs.gnu.org
Subject: Re: bug#5754: Bytecomp Arithmetic test failed
Date: Sun, 04 Apr 2010 10:05:03 +0200
Chong Yidong <cyd <at> stupidchicken.com> writes:

> The key is that if I compile Emacs with CFLAGS="-g", then
>
> (funcall
>  (byte-compile
>   (list 'lambda nil
> 	(quote (let ((a (expt 2 -1074)) (b 0.125)) (* a 8 b))))))
>
> returns 0.0.  If I compile Emacs with CFLAGS="-g -O2", then it returns
> 5e-324.
>
> It looks like this may be a compiler bug.

It's most likely the effect of excess precision, due to floating point
values being held in registers instead of reloaded from memory.  Try
-ffloat-store.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




bug closed, send any further explanations to 5754 <at> debbugs.gnu.org and Juri Linkov <juri <at> jurta.org> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 28 Jan 2012 17:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 26 Feb 2012 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 169 days ago.

Previous Next


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