com php-src: Fixed uninitialized var warning: Zend/zend_compi le.c
| From: | Nikita Popov | Date: | Fri, 31 May 2019 10:55:13 +0000 |
| Subject: | com php-src: Fixed uninitialized var warning: Zend/zend_compi le.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106487@lists.php.net to get a copy of this message | ||
Commit: 67b84e45489e944e144429a26f3294161c1c7e0a
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 31 May 2019 12:55:13 +0200
Parents: dd2bf448693df98d060d784fed798ec9ba461fad
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=67b84e45489e944e144429a26f3294161c1c7e0a
Log:
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...
Changed paths:
M Zend/zend_compile..c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index b4d4012..52511ac 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);
}
}