Persona is no longer an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 253241 - wrong JS math in 64bit systems
: wrong JS math in 64bit systems
: fixed-aviary1.0, fixed1.7.5
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86 Linux
: -- major (vote)
: ---
Assigned To: Wolfgang Rosenauer [:wolfiR]
: Phil Schwartau
: Jason Orendorff [:jorendorff]
: 257221 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2004-07-27 02:53 PDT by Wolfgang Rosenauer [:wolfiR]
Modified: 2004-11-17 04:38 PST (History)
10 users (show)
brendan: blocking‑aviary1.0+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

build output from make -f Makefile.ref (42.59 KB, text/plain)
2004-07-28 22:02 PDT, Wolfgang Rosenauer [:wolfiR]
no flags Details
fix endian problems (1.10 KB, patch)
2004-09-08 22:13 PDT, Nicholas Miell
shaver: review+
brendan: approval‑aviary+
brendan: approval1.7.5+
Details | Diff | Splinter Review

Description Wolfgang Rosenauer [:wolfiR] 2004-07-27 02:53:31 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a3) Gecko/20040725
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a3) Gecko/20040725

use a 64bit build of mozilla (at least AMD64) under Linux and open the given URL.
All prices are zero. They are someway calculated as JavaScript code. So it seems
that the JS engine is not 64bit clean.

Reproducible: Always
Steps to Reproduce: URL with 64bit mozilla
2.look at the prices URL with 32bit mozilla
4.look at the prices again

Actual Results:  
with 64bit system all prices are 0

Expected Results:  
you should get the same prices
Comment 1 Brendan Eich [:brendan] 2004-07-27 10:54:42 PDT
JS has been 64-bit clean for six+ years on many platforms, including DEC Alpha.
 You'll have to debug this more yourself, and say *exactly* what version and
brand of compiler you are using.

Comment 2 Wolfgang Rosenauer [:wolfiR] 2004-07-27 11:57:43 PDT
it's on SUSE Linux 9.1 for AMD64 using the compiler:
gcc (GCC) 3.3.3 (SUSE Linux)

If you tell me what else I could debug myself I will try it.
Perhaps I can try it on IA64 tomorrow.
Comment 3 timeless 2004-07-27 16:58:21 PDT
cvs co mozilla/js/src
cd mozilla/js/src
make -f Makefile.ref
cd *.OBJ/


evaluate js here until you find your problem.

when you find the math that doesn't work, repeat the process on an i386 system.
Comment 4 Wolfgang Rosenauer [:wolfiR] 2004-07-28 04:19:05 PDT
I will see what I can do. But at this time I only get a compile error for this
and count 65 times:

warning: cast from pointer to integer of different size
warning: cast to pointer from integer of different size

I can really imagine that this can lead to wrong math-functions.
Comment 5 Brendan Eich [:brendan] 2004-07-28 19:00:33 PDT
Wolfgang: what *error* do you get?  Can you give file and line for those
warnings (which I assume were not the error you mentioned)?

Comment 6 Wolfgang Rosenauer [:wolfiR] 2004-07-28 22:02:04 PDT
Created attachment 154618 [details]
build output from make -f Makefile.ref
Comment 7 timeless 2004-07-29 22:13:03 PDT
that'd probably be Bug 249478
Comment 8 Wolfgang Rosenauer [:wolfiR] 2004-08-09 12:24:17 PDT
the build error is this bug.
But the main problem is that something is calculating wrong in JS.
And in general I count 333 build warnings about invalid casts on AMD64 for the
mozilla source. It seems AMD64 is a problematic platform if it comes to 
integer <-> pointer casts.

And sorry. I was unable to strip down a testcase because my HTML and JS 
experience is not good and the example URL has complicated contents.
So any news?
Comment 9 Nicholas Miell 2004-09-08 21:16:59 PDT
This should be easier to track down than "something is calculating wrong in JS"

[nicholas@entropy firefox]$ ./ ./xpcshell
js> Math.acos(1)
js> Math.acos(0.99)
[nicholas@entropy firefox]$ uname -a
Linux entropy 2.6.8-1.549smp #1 SMP Mon Sep 6 16:20:20 EDT 2004 x86_64 x86_64
x86_64 GNU/Linux
Comment 10 Nicholas Miell 2004-09-08 21:50:32 PDT
Looking at fdlibm.h, it appears that an architecture's endianness must be
explicitly specified, and big endian is assumed.

The fix is trivial, but that begs the question of why fdlibm is used in the
first place instead of the OS provided math library.
Comment 11 Brendan Eich [:brendan] 2004-09-08 21:53:18 PDT
If your OS's math lib satisfies ECMA-262 Edition 3's requirements, then you can
dispense with fdlibm.  The js/tests suite may not be enough to verify that your
OS's math lib satisfies, however.

Comment 12 Nicholas Miell 2004-09-08 22:13:00 PDT
Created attachment 158276 [details] [diff] [review]
fix endian problems

This fixes the endian problems for AMD64, in a broken non-future proof manner.
As a bonus, VA_COPY is changed to the correct va_copy.
Comment 13 Mike Shaver (:shaver -- probably not reading bugmail closely) 2004-09-08 22:32:48 PDT
Comment on attachment 158276 [details] [diff] [review]
fix endian problems

I'm down with this.  Thanks for the diagnosis and patch.

I'd like this on both branches, as it's a serious porting fix for an important
Comment 14 Brendan Eich [:brendan] 2004-09-08 22:41:39 PDT
Comment on attachment 158276 [details] [diff] [review]
fix endian problems

Yeah, this should go into both branches.

Comment 15 Nicholas Miell 2004-09-08 22:48:55 PDT
Actually, a better fix would be to make fdlibm.h include jscpucfg.h/jsautocfg.h
and do
Comment 16 Christopher Aillon (sabbatical, not receiving bugmail) 2004-09-23 14:45:13 PDT
Has a fix for this been landed anywhere?  This needs to be fixed for 1.0 IMO
Comment 17 Brendan Eich [:brendan] 2004-09-23 16:35:04 PDT
Comment 15 points the way, but I'm checking in the reviewed and approved patch
for the branches and trunk right now.

Comment 18 timeless 2004-09-23 20:00:11 PDT
brendan, this busted: monkeypox, speedracer, and worms
Comment 19 Brendan Eich [:brendan] 2004-09-23 20:32:41 PDT
I undid the jsprf.c change.  Nicholas, please file a separate bug and provide a
patch for it that doesn't break the ports tinderboxes broken by your jsprf.c
patch attached here.

Comment 20 Christopher Aillon (sabbatical, not receiving bugmail) 2004-11-17 04:38:24 PST
*** Bug 257221 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.