com php-src: Fixed handling of return statement without a value.: ext/opcache/Optimizer/zend_inference.c ext/opcache/Optimi zer/zend_ssa.c
| From: | Dmitry Stogov | Date: | Thu, 07 Apr 2016 15:59:04 +0000 |
| Subject: | com php-src: Fixed handling of return statement without a value.: ext/opcache/Optimizer/zend_inference.c ext/opcache/Optimi zer/zend_ssa.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91651@lists.php.net to get a copy of this message | ||
Commit: aed42496534fe54c5c0ce64fe0ca5c9d801d6161
Author: Dmitry Stogov <dmitry@zend.com> Thu, 7 Apr 2016 18:59:04 +0300
Parents: 8921449785163556b1565b6c5c2a27a1f2b2a20b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=aed42496534fe54c5c0ce64fe0ca5c9d801d6161
Log:
Fixed handling of return statement without a value.
Changed paths:
M ext/opcache/Optimizer/zend_inference..c
M ext/opcache/Optimizer/zend_ssa.c
Diff:
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 51817ab..38a278d 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3666,19 +3666,19 @@ static void zend_update_type_info(const zend_op_array *op_array,
tmp = zend_fetch_arg_info(script, ret_info, &ce);
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
- if (opline->op1_type == IS_CONST) {
- UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
+ if (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV)) {
+ UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
if (ce) {
- UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_ops[i].result_def);
+ UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_ops[i].op1_def);
} else {
- UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_ops[i].result_def);
+ UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_ops[i].op1_def);
}
} else {
- UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
+ UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
- UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_ops[i].op1_def);
+ UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_ops[i].result_def);
} else {
- UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_ops[i].op1_def);
+ UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_ops[i].result_def);
}
}
break;
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index 438dcc5..a55ccc9 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -666,7 +666,7 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
}
break;
case ZEND_VERIFY_RETURN_TYPE:
- if (opline->op1_type != IS_CONST) {
+ if (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV)) {
ssa_ops[k].op1_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
ssa_vars_count++;