From 9bf1e53bbc1c708f7ddc9ffc4367d0d33ed1f611 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sat, 11 Jul 2020 19:24:20 +0200 Subject: [PATCH] [skip ci] Explain in comment why match default arm is emitted first --- Zend/zend_compile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 2f278fdfffab0..345fdd63c49c9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5297,6 +5297,8 @@ void zend_compile_match(znode *result, zend_ast *ast) uint32_t cond_count = 0; uint32_t *jmp_end_opnums = safe_emalloc(sizeof(uint32_t), arms->children, 0); + // The default arm is emitted first to avoid live range issues where the tmpvar for the + // arm result is freed even though it has not been initialized yet. if (!has_default_arm) { if (!uses_jumptable) { zend_update_jump_target_to_next(opnum_default_jmp);