From 32d67855e6d7db1a221ab8dcdd5cf5546f9c0076 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 11 Sep 2024 16:03:38 +0300 Subject: [PATCH] Update IR IR commit: 4cb5282c895908cfd4547ab460de86d189d15177 Fixes GH-15662: Segmentation fault in ext/opcache/jit/ir/ir_cfg.c --- ext/opcache/jit/ir/ir_cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/opcache/jit/ir/ir_cfg.c b/ext/opcache/jit/ir/ir_cfg.c index 81ecc09c9ea..2a26ec65412 100644 --- a/ext/opcache/jit/ir/ir_cfg.c +++ b/ext/opcache/jit/ir/ir_cfg.c @@ -97,7 +97,7 @@ int ir_build_cfg(ir_ctx *ctx) /* Some successors of IF and SWITCH nodes may be inaccessible by backward DFS */ use_list = &ctx->use_lists[end]; n = use_list->count; - if (n > 1) { + if (n > 1 || (n == 1 && (ir_op_flags[insn->op] & IR_OP_FLAG_TERMINATOR) != 0)) { for (p = &ctx->use_edges[use_list->refs]; n > 0; p++, n--) { /* Remember possible inaccessible successors */ ir_bitset_incl(bb_leaks, *p); @@ -245,6 +245,7 @@ int ir_build_cfg(ir_ctx *ctx) IR_ASSERT(ref); ir_ref pred_b = _blocks[ref]; ir_block *pred_bb = &blocks[pred_b]; + IR_ASSERT(pred_b > 0); *q = pred_b; edges[pred_bb->successors + pred_bb->successors_count++] = b; }