Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -6850,7 +6850,9 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit,
if (res_inputs->count == 1) {
phi = res_inputs->refs[0];
} else {
phi = ir_PHI_N((var_def_info & MAY_BE_LONG & MAY_BE_LONG) ? IR_LONG : IR_DOUBLE,
/* var_def_info may be ANY (e.g. ASSIGN_DIM) so use the fact that phi inputs must be the same type,
* and therefore use the type of the incoming values. */
phi = ir_PHI_N(jit->ctx.ir_base[res_inputs->refs[0]].type,
res_inputs->count, res_inputs->refs);
}
if (Z_MODE(var_addr) == IS_REG) {
Expand Down
27 changes: 27 additions & 0 deletions ext/opcache/tests/jit/assign_dim_028.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--TEST--
JIT ASSIGN_DIM: result in double register with multiple assignment paths
--EXTENSIONS--
opcache
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit=function
--FILE--
<?php

function f($k) {
$x = [];
for ($i = 0; $i < 3; $i++) {
$a + $x[] = $k;
$a = $b = $a = $x[$k . $k] = 0.5;
}
var_dump($a, $b);
}

f("1");

?>
--EXPECTF--
Warning: Undefined variable $a in %s on line %d
float(0.5)
float(0.5)
Loading