Skip to content

Commit 6f6fd27

Browse files
committed
ARM64: range.phpt failed under RELEASE mode
Test case "ext/standard/tests/array/range.phpt" failed on ARM64 machine only under RELEASE mode. How to reproduce it: ``` ./buildconf -f; ./configure; make -j 128 make test TESTS="-d opcache.enable=1 -d opcache.enable_cli=1 ext/standard/tests/array/range.phpt" ``` Root cause: I suspect the root cause is that on ARM64 machine, PHP RELEASE mode produces different values for internal function range() compared to DEBUG mode. Take the downsized test case downsize-range.php [1] as an example. We applied the check-element.diff patch to check the original values. Note that we print out the floating point numbers with precision 16. From the outputs in file output.md, we can see the 7-th and 9-th elements are different between RELEASE and DEBUG. To be honest, I didn't get where such difference comes from and probably this is due to different compilation options used by RELEASED and DEBUG. Fix: After commit [2], serialize_precision is used for var_dump(). As a result, the pre-set "precision=14" didn't work actually. In this patch, we turn to set serialize_precision as 14 and therefore the difference between RELEASE and DEBUG can be eliminated. Note-1: this failue didn't occur on x86 machine. Note-2: in my local test, this is the only test case which behaves differently on ARM64 machine under RELEASE and DEBUG mode. [1] https://gist.github.com/shqking/0d55abf8dbaafde4a00ea9304e71f06b [2] a939805 Change-Id: I9293e990925590f8d7cfb2462d8d760abf76069f
1 parent ec54ffa commit 6f6fd27

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ext/standard/tests/array/range.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Test range() function
33
--INI--
4-
precision=14
4+
serialize_precision=14
55
--FILE--
66
<?php
77

@@ -347,7 +347,7 @@ array(11) {
347347
[6]=>
348348
float(1.6)
349349
[7]=>
350-
float(1.7000000000000002)
350+
float(1.7)
351351
[8]=>
352352
float(1.8)
353353
[9]=>
@@ -371,7 +371,7 @@ array(11) {
371371
[6]=>
372372
float(1.4)
373373
[7]=>
374-
float(1.2999999999999998)
374+
float(1.3)
375375
[8]=>
376376
float(1.2)
377377
[9]=>
@@ -395,7 +395,7 @@ array(11) {
395395
[6]=>
396396
float(1.6)
397397
[7]=>
398-
float(1.7000000000000002)
398+
float(1.7)
399399
[8]=>
400400
float(1.8)
401401
[9]=>
@@ -419,7 +419,7 @@ array(11) {
419419
[6]=>
420420
float(1.6)
421421
[7]=>
422-
float(1.7000000000000002)
422+
float(1.7)
423423
[8]=>
424424
float(1.8)
425425
[9]=>

0 commit comments

Comments
 (0)