jerryscript icon indicating copy to clipboard operation
jerryscript copied to clipboard

ICE: Assertion 'buff_index <= buff_size' failed at (ecma_builtin_number_prototype_object_to_string):309

Open egavrin opened this issue 11 years ago • 7 comments

Version: 17a5dd27bbbadc036d83be0448f9edfa90800147

System:

Linux eg 4.2.0-18-generic #22-Ubuntu SMP Fri Nov 6 18:25:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Output:


ICE: Assertion 'buff_index <= buff_size' failed at /home/eg/dev/jr/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.cpp(ecma_builtin_number_prototype_object_to_string):309.
Error: ERR_FAILED_INTERNAL_ASSERTION

Test case:

// Cj
var big = 2147483646;

big++;
assert(big == 2147483647);

big += 1;
assert(big == 2147483648); // s

big++;
assert(big == 2147483649); // s

assert ((1152921504606846600).toString([1,2,3,4].slice(1,2)) === "11506847000")

rt (1.79e+308 === Infinity);

egavrin avatar Nov 24 '15 14:11 egavrin

Fails on current master (91a0514).

Minimal testcase: assert ((1152921504606846600).toString([1,2,3,4].slice(1,2)) === "11506847000");

LaszloLango avatar Feb 08 '16 09:02 LaszloLango

Still fails on current master (9bce5b0).

ktorpi avatar Jul 11 '16 11:07 ktorpi

The issue is still valid on current master (8edab96).

akosthekiss avatar Aug 29 '16 17:08 akosthekiss

Still fails on master (62a581f).

$ build/bin/jerry jerry> assert ((1152921504606846600).toString([1,2,3,4].slice(1,2)) === "11506847000"); ICE: Assertion 'buff_index <= buff_size' failed at /home/t/jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c(ecma_builtin_number_prototype_object_to_string):409. Error: ERR_FAILED_INTERNAL_ASSERTION

tilmannOSG avatar Feb 24 '17 09:02 tilmannOSG

I have no idea how to fix this. Problem is:

log (115292150460684000) / log (2) = 59.999999999999999529496732252183888148671846990644

(Computed by: http://keisan.casio.com/calculator )

floor(log (115292150460684000) / log (2)) -> should be 59.

However, it is 60 with double precision.

zherczeg avatar Feb 27 '17 10:02 zherczeg

@zherczeg : That's right! The problem comes from the inaccuracy of the log (115292150460684660) / log (2) division. I've added a PR above, which fixes it.

robertsipka avatar Mar 09 '17 08:03 robertsipka

Fixed in #1650.

robertsipka avatar Mar 20 '17 07:03 robertsipka