From 7c8b3b2c9654dff669f9bb93a99f31f17062921e Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 10 Sep 2024 16:14:03 +0300 Subject: [PATCH] Fix GH-15821: Core dumped in Zend/Optimizer/zend_inference.c:4062 --- Zend/Optimizer/zend_inference.c | 2 +- ext/opcache/tests/jit/gh15821.phpt | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ext/opcache/tests/jit/gh15821.phpt diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 1c5e99dd30a..e457c24b18a 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -4056,11 +4056,11 @@ static zend_always_inline zend_result _zend_update_type_info( fprintf(stderr, "Missing op2 type inference for opcode %s, line %d\n", zend_get_opcode_name(opline->opcode), opline->lineno); } #endif -unknown_opcode: if (ssa_op->op1_def >= 0) { tmp = MAY_BE_ANY | MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; UPDATE_SSA_TYPE(tmp, ssa_op->op1_def); } +unknown_opcode: if (ssa_op->result_def >= 0) { tmp = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; if (opline->result_type == IS_TMP_VAR) { diff --git a/ext/opcache/tests/jit/gh15821.phpt b/ext/opcache/tests/jit/gh15821.phpt new file mode 100644 index 00000000000..788c4a8e1f5 --- /dev/null +++ b/ext/opcache/tests/jit/gh15821.phpt @@ -0,0 +1,20 @@ +--TEST-- +GH-15821 (Core dumped in Zend/Optimizer/zend_inference.c:4062) +--EXTENSIONS-- +opcache +--INI-- +opcache.jit=1203 +opcache.jit_buffer_size=64M +--FILE-- + +--EXPECT-- +Done