com php-src: Fixed bug in type inference: ext/opcache/Optimizer /zend_inference.c ext/opcache/tests/ssa_bug_011 .phpt
| From: | Dmitry Stogov | Date: | Mon, 27 Nov 2017 07:16:16 +0000 |
| Subject: | com php-src: Fixed bug in type inference: ext/opcache/Optimizer /zend_inference.c ext/opcache/tests/ssa_bug_011 .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100376@lists.php.net to get a copy of this message | ||
Commit: 776bef8447f2848c043e4716a1e08c4ac5a88fdb
Author: Dmitry Stogov <dmitry@zend.com> Mon, 27 Nov 2017 10:16:16 +0300
Parents: fee6c812c400d5c68b8851cec2a95686dc06129b
Branches: PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=776bef8447f2848c043e4716a1e08c4ac5a88fdb
Log:
Fixed bug in type inference
Changed paths:
M ext/opcache/Optimizer/zend_inference.c
A ext/opcache/tests/ssa_bug_011.phpt
Diff:
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 5d27c94..ef82135 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3079,7 +3079,8 @@ static int zend_update_type_info(const zend_op_array *op_array,
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
} else {
/* invalid key type */
- UPDATE_SSA_TYPE(t1, ssa_ops[i].op1_def);
+ tmp = (tmp & (MAY_BE_RC1|MAY_BE_RCN)) | (t1 & ~(MAY_BE_RC1|MAY_BE_RCN));
+ UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
}
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
}
diff --git a/ext/opcache/tests/ssa_bug_011.phpt b/ext/opcache/tests/ssa_bug_011.phpt
new file mode 100644
index 0000000..58f3980
--- /dev/null
+++ b/ext/opcache/tests/ssa_bug_011.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Type inference warning
+--FILE--
+<?php
+function renderRawGraph(array $parents) {
+ $graph = array();
+ foreach ($parents as $p) {
+ foreach ($graph as $v) {
+ $graph[$v]['line'] = 1;
+ }
+ $graph[] = array(
+ 'line' => 1,
+ );
+ }
+}
+?>
+OK
+--EXPECT--
+OK