From 67b84e45489e944e144429a26f3294161c1c7e0a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 31 May 2019 12:55:13 +0200 Subject: [PATCH] Fixed uninitialized var warning Causes build failure on release+zts azure build. I'm rewriting this code to separate the if/else handling, because they don't really have anything in common anyway... --- Zend/zend_compile.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b4d4012d7f..52511aca4e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4625,21 +4625,22 @@ void zend_compile_if(zend_ast *ast) /* {{{ */ zend_ast *cond_ast = elem_ast->child[0]; zend_ast *stmt_ast = elem_ast->child[1]; - znode cond_node; - uint32_t opnum_jmpz; if (cond_ast) { + znode cond_node; + uint32_t opnum_jmpz; zend_compile_expr(&cond_node, cond_ast); opnum_jmpz = zend_emit_cond_jump(ZEND_JMPZ, &cond_node, 0); - } - - zend_compile_stmt(stmt_ast); - if (i != list->children - 1) { - jmp_opnums[i] = zend_emit_jump(0); - } + zend_compile_stmt(stmt_ast); - if (cond_ast) { + if (i != list->children - 1) { + jmp_opnums[i] = zend_emit_jump(0); + } zend_update_jump_target_to_next(opnum_jmpz); + } else { + /* "else" can only occur as last element. */ + ZEND_ASSERT(i == list->children - 1); + zend_compile_stmt(stmt_ast); } } -- 2.40.0