Closed Bug 61966 Opened 24 years ago Closed 23 years ago

Math.max(), Math.min(), Math.random() failing on Linux

Categories

(Core :: JavaScript Engine, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: pschwartau, Assigned: rogerl)

Details

Attachments

(2 files)

Three math testcases are failing on my Linux box. Also one string testcase 
that relies on Math.max() and Math.min()

                      ecma/Math/15.8.2.11.js
                      ecma/Math/15.8.2.12.js
                      ecma/Math/15.8.2.14.js
                      ecma/String/15.5.4.7-2.js


ecma/Math/15.8.2.14.js is the worst: it crashes. But it's peculiar;
if I do this in the JS shell, it does not crash and the test passes:

./js
js> load('../../tests/ecma/shell.js');
js> load('../../tests/ecma/Math/15.8.2.14.js')
15.8.2.14 Math.random()
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
             .
            etc. 
            etc.


HOWEVER, the test driver does this, and I get a crash (on Linux):

./js -f ../../tests/ecma/shell.js -f ../../tests/ecma/Math/15.8.2.14.js
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
             .
            etc. 
            etc.
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Math.random() = pass PASSED!
Segmentation fault(core dumped)


Note this is happening to me only on Linux, not on WinNT. I tried to use gdb
to get a stack trace, but was unsuccessful at passing the -f arguments.


Will attach details from the test driver on all four testcases -
I'm seeing intermittent failures running the tests from the browser; each
clobber (with different patches) seems to give me a different result, all
involving failures with NaN and Infinity.  One promising note is that I saw two
tiny double values that differed in the last few places as different between two
tests.  We might be looking at uninitialized memory.
Resolving WORKSFORME on Linux with JS shell built on 2001-02-22.
Also works on WinNT, Mac. 
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → VERIFIED
Marking Verified - 
Reopening bug. These testcases are failing, and again only on Linux:
all rely on Math.max(), Math.min(), Math.random() in some way.

                      ecma/Math/15.8.2.11.js
                      ecma/Math/15.8.2.12.js
                      ecma/Math/15.8.2.14.js
                      ecma/String/15.5.4.7-1.js 
                      ecma/String/15.5.4.7-2.js

cc'ing Patrick, Brendan in case they are aware of any recent JS changes
that may have caused this- 
Status: VERIFIED → REOPENED
Resolution: WORKSFORME → ---
If you compare the new test failures against the old, they differ.
For example: 
                                OLD                    NEW
ecma/Math/15.8.2.11.js       compare-errors           segfault        
ecma/Math/15.8.2.12.js       compare-errors           segfault

ecma/Math/15.8.2.14.js is failing because Math.random() == Infinity 
on my Linux box now. We expect Math.random() to lie between 0 and 1.
Phil, what stack do you get (segfault implies core file dropped, so hop into gdb
and bt)?  Did you clobber and rebuild after the fix for bug 8112-reopen went in
and was updated in your tree?

/be
js> load('../../tests/js1_4/shell.js')
js> load('../../tests/ecma/Math/15.8.2.11.js')  
15.8.2.11 Math.max(x, y)

Program received signal SIGSEGV, Segmentation fault.
0x8097b37 in math_max (cx=0x80e4b78, obj=0x80e6ab0, argc=0,
argv=0x80ee3e0,                                                rval=0xbfffe520)
at jsmath.c:233
233         jsdouble x, z = *cx->runtime->jsNegativeInfinity;

(gdb) bt
#0  0x8097b37 in math_max (cx=0x80e4b78, obj=0x80e6ab0, argc=0,
argv=0x80ee3e0,                                            rval=0xbfffe520) at
jsmath.c:233
#1  0x807f148 in js_Invoke (cx=0x80e4b78, argc=0, flags=0) at jsinterp.c:813
#2  0x809117d in js_Interpret (cx=0x80e4b78, result=0xbfffe7a8)
at                                                                            
jsinterp.c:2706
#3  0x807f759 in js_Execute (cx=0x80e4b78, chain=0x80e6340,
script=0x80fae60,                       down=0x0, special=0, result=0xbfffe7a8)
at jsinterp.c:992
#4  0x8052b30 in JS_ExecuteScript (cx=0x80e4b78,
obj=0x80e6340,                                          script=0x80fae60,
rval=0xbfffe7a8) at jsapi.c:3183         
#5  0x8049e87 in Load (cx=0x80e4b78, obj=0x80e6340, argc=1,
argv=0x80ee304,                                                rval=0xbfffe864)
at js.c:637
#6  0x807f148 in js_Invoke (cx=0x80e4b78, argc=1, flags=0) at jsinterp.c:813
#7  0x809117d in js_Interpret (cx=0x80e4b78, result=0xbffffb00)
at                                                                            
jsinterp.c:2706
#8  0x807f759 in js_Execute (cx=0x80e4b78, chain=0x80e6340,
script=0x80ec868,                       down=0x0, special=0, result=0xbffffb00)
at jsinterp.c:992
#9  0x8052b30 in JS_ExecuteScript (cx=0x80e4b78,
obj=0x80e6340,                                          script=0x80ec868,
rval=0xbffffb00) at jsapi.c:3183
#10 0x8049632 in Process (cx=0x80e4b78, obj=0x80e6340, filename=0x0) at js.c:371
#11 0x8049af1 in ProcessArgs (cx=0x80e4b78, obj=0x80e6340,
argv=0xbffffbc8,                                                                
argc=0) at js.c:529
#12 0x804c069 in main (argc=0, argv=0xbffffbc8) at js.c:2096
Since that turned out to be almost unreadable, let's try again! 

js> load('../../tests/js1_4/shell.js')
js> load('../../tests/ecma/Math/15.8.2.11.js')  
15.8.2.11 Math.max(x, y)

Program received signal SIGSEGV, Segmentation fault.
0x8097b37 in math_max (cx=0x80e4b78, obj=0x80e6ab0, argc=0, argv=0x80ee3e0, 
                                          rval=0xbfffe520) at jsmath.c:233
233         jsdouble x, z = *cx->runtime->jsNegativeInfinity;

(gdb) bt
#0  0x8097b37 in math_max (cx=0x80e4b78, obj=0x80e6ab0, argc=0, argv=0x80ee3e0, 
rval=0xbfffe520) at jsmath.c:233
#1  0x807f148 in js_Invoke (cx=0x80e4b78, argc=0, flags=0) at jsinterp.c:813
#2  0x809117d in js_Interpret (cx=0x80e4b78, result=0xbfffe7a8) at 
jsinterp.c:2706
#3  0x807f759 in js_Execute (cx=0x80e4b78, chain=0x80e6340, script=0x80fae60, 
down=0x0, special=0, result=0xbfffe7a8) at jsinterp.c:992
#4  0x8052b30 in JS_ExecuteScript (cx=0x80e4b78, obj=0x80e6340, 
script=0x80fae60, rval=0xbfffe7a8) at jsapi.c:3183
#5  0x8049e87 in Load (cx=0x80e4b78, obj=0x80e6340, argc=1, argv=0x80ee304, 
rval=0xbfffe864) at js.c:637
#6  0x807f148 in js_Invoke (cx=0x80e4b78, argc=1, flags=0) at jsinterp.c:813
#7  0x809117d in js_Interpret (cx=0x80e4b78, result=0xbffffb00) at 
jsinterp.c:2706
#8  0x807f759 in js_Execute (cx=0x80e4b78, chain=0x80e6340, script=0x80ec868, 
down=0x0, special=0, result=0xbffffb00) at jsinterp.c:992
#9  0x8052b30 in JS_ExecuteScript (cx=0x80e4b78, obj=0x80e6340, 
script=0x80ec868, rval=0xbffffb00) at jsapi.c:3183
#10 0x8049632 in Process (cx=0x80e4b78, obj=0x80e6340, filename=0x0) at js.c:371
#11 0x8049af1 in ProcessArgs (cx=0x80e4b78, obj=0x80e6340, argv=0xbffffbc8, 
argc=0) at js.c:529
#12 0x804c069 in main (argc=0, argv=0xbffffbc8) at js.c:2096
Brendan's idea worked: 

>Did you clobber and rebuild after the fix for bug 8112-reopen went in
>and was updated in your tree?


Note I always do make -f Makefile.ref clean before I rebuild the shell.
This time I actually deleted the OBJ directories by hand, and for good measure, 
deleted the js/src/fdlibm directory and re-pulled it. Now, all the tests pass!

I'll resolve this once again as WORKSFORME. If anyone feels the 
stack trace reveals something deeper that is wrong, please reopen - 
Status: REOPENED → RESOLVED
Closed: 24 years ago23 years ago
Resolution: --- → WORKSFORME
Note: On my Linux box, Math.random() once again lies between 0 and 1 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: