[php-src] PR #21383: Fix GH-20838: JIT compiler produces wrong arithmetic results
| From: | iliaal | Date: | Sun, 08 Mar 2026 01:15:43 +0000 |
| Subject: | [php-src] PR #21383: Fix GH-20838: JIT compiler produces wrong arithmetic results | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35131@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21383
Author: iliaal
## Summary
- When an opcode falls through to the handler path in JIT trace compilation and an operand has
MAY_BE_GUARD, the guard is widened to MAY_BE_ANY but never emitted as a
runtime type check
- The handler can produce a result type different from the TSSA prediction (e.g.
IS_LONG instead of IS_DOUBLE for MUL with mixed string/numeric operands),
but SET_STACK_TYPE unconditionally records the predicted concrete type as
mem_type
- Side traces entering via the exit point then load the slot from memory assuming the predicted
type, interpreting raw IS_LONG bytes as IEEE 754 double (producing values like
3.7054923438093E-322 instead of 75)
- Fix: don't trust the TSSA concrete result type when the handler path is taken and any operand
had MAY_BE_GUARD
Fixes #20838