-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-14873: PHP 8.4 min function fails on typed integer #14876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bdb8a03
to
4354ce4
Compare
e6ff7b4
to
7fb919a
Compare
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.
I wonder if it might be easier to adjust the DFA pass instead, by special casing frameless calls. This would also avoid the copy in the VM. |
Maybe. Then you do have an extra copy opline though from the temporary return value to the CV AFAIK |
@nielsdos Not having looked at this yet, it seems that was mostly the case anyway, given we haven't seen any other failures, right? |
That is true. |
|
max() is in fact affected. The bug is not in the min/max implementation but either in the optimizer of the VM/JIT depending on the PoV. |
The problem is that this line in the VM: `ZVAL_NULL(result);` changes the type of arg1 as well, because after the DFA pass the result and input both use CV0($result). We should not contract assignments with CVs in frameless calls with arguments. An older attempt is found at phpGH-14876 that tried to modify the VM/JIT.
The problem is that this line in the VM: `ZVAL_NULL(result);` changes the type of arg1 as well, because after the DFA pass the result and input both use CV0($result). We should not contract assignments with CVs in frameless calls with arguments. An older attempt is found at phpGH-14876 that tried to modify the VM/JIT.
The problem is that this line in the VM: `ZVAL_NULL(result);` changes the type of arg1 as well, because after the DFA pass the result and input both use CV0($result). We should not contract assignments with CVs in frameless calls with arguments. An older attempt is found at GH-14876 that tried to modify the VM/JIT. Closes GH-14903.
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.