From 5f46d86955992d73a4845bd51d620726fde35a08 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 26 Oct 2023 23:58:29 +0300 Subject: [PATCH] Fixed GH-12509: JIT assertion when running php-parser tests --- Zend/Optimizer/zend_inference.c | 6 ++++++ ext/opcache/tests/jit/gh12509.phpt | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 ext/opcache/tests/jit/gh12509.phpt diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index ea144bbb34c..97b5aa3ede6 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -1746,6 +1746,12 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) { } \ if (__var >= 0) { \ zend_ssa_var *__ssa_var = &ssa_vars[__var]; \ + if (__ssa_var->var < op_array->num_args) { \ + if (__type & MAY_BE_RC1) { \ + /* TODO: may be captured by exception backtreace */ \ + __type |= MAY_BE_RCN; \ + } \ + } \ if (__ssa_var->var < op_array->last_var) { \ if (__type & (MAY_BE_REF|MAY_BE_RCN)) { \ __type |= MAY_BE_RC1 | MAY_BE_RCN; \ diff --git a/ext/opcache/tests/jit/gh12509.phpt b/ext/opcache/tests/jit/gh12509.phpt new file mode 100644 index 00000000000..ae8bdee6619 --- /dev/null +++ b/ext/opcache/tests/jit/gh12509.phpt @@ -0,0 +1,28 @@ +--TEST-- +GH-12509: JIT assertion when running php-parser tests +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--FILE-- + +--EXPECT-- +array(3) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} \ No newline at end of file