[php-src] PR #25749: Add signed-zero arithmetic regression tests for GH-25744
| From: | rafamolina1 | Date: | Wed, 25 Nov 2026 18:02:08 +0000 |
| Subject: | [php-src] PR #25749: Add signed-zero arithmetic regression tests for GH-25744 | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41007@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25749
Author: rafamolina1
Adding zero to a known float can incorrectly preserve negative zero when the DFA pass replaces the
arithmetic operation with a copy. This PR adds supplementary regression coverage for #25744.
Depends on #25608, which provides the optimizer fix and its initial regression test. This PR
contains only the additional
ext/opcache/tests/opt/gh25744.phpt test; it is a draft
because the test currently fails without that fix. It can be merged after #25608 or cherry-picked
into it.
The test covers both operand orders for addition, positive and negative zero constants, subtraction,
negative finite operands, infinities, NaN, and integer controls. It checks zero signs through
reciprocals and serialization, plus observable string and JSON results after casts and rounding. Hot
functions exercise JIT configurations as well.
Validation on PHP-8.4, PHP-8.5, PHP-8.6, and master:
- The test fails on the unpatched base and passes with the #25608 fix, with JIT disabled, tracing
JIT, and function JIT. JIT activity was confirmed through generated buffer usage.
- Expected output matches execution with OPcache disabled and with the DFA pass disabled.
- Zend and OPcache suites were compared before and after applying the fix together with the
additional test: no new failures on any branch. PHP-8.5, PHP-8.6, and master had no failures;
PHP-8.4 retained the same gh17733 and gh8739 failures as the base.