mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Fix DFG construction for VERIFY_RETURN
`use` only contains uses prior to definition. This was not honoured for VERIFY_RETURN with a temporary operand. The test case only breaks on PHP 7.2.
This commit is contained in:
parent
a8f98fc7f7
commit
69ec51eb02
@ -144,11 +144,11 @@ op1_use:
|
||||
}
|
||||
} else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
|
||||
var_num = EX_VAR_TO_NUM(opline->op1.var);
|
||||
if (!DFG_ISSET(def, set_size, j, var_num)) {
|
||||
DFG_SET(use, set_size, j, var_num);
|
||||
}
|
||||
if (opline->opcode == ZEND_VERIFY_RETURN_TYPE) {
|
||||
DFG_SET(use, set_size, j, var_num);
|
||||
DFG_SET(def, set_size, j, var_num);
|
||||
} else if (!DFG_ISSET(def, set_size, j, var_num)) {
|
||||
DFG_SET(use, set_size, j, var_num);
|
||||
}
|
||||
}
|
||||
if (opline->op2_type == IS_CV) {
|
||||
|
16
ext/opcache/tests/verify_return_dfg.phpt
Normal file
16
ext/opcache/tests/verify_return_dfg.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Incorrect liveness computation for verify-return
|
||||
--FILE--
|
||||
<?php
|
||||
function test($foo): string
|
||||
{
|
||||
switch ($foo) {
|
||||
default: $bar = 'x'; break;
|
||||
case 'z': $bar = 'y'; break;
|
||||
}
|
||||
return (string)$bar;
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
===DONE===
|
Loading…
Reference in New Issue
Block a user