com php-src: Fixed wrong assertion: ext/opcache/Optimizer/dfa _pass.c ext/opcache/tests/ssa_bug_011.phpt
| From: | Dmitry Stogov | Date: | Mon, 10 Sep 2018 12:26:38 +0000 |
| Subject: | com php-src: Fixed wrong assertion: ext/opcache/Optimizer/dfa _pass.c ext/opcache/tests/ssa_bug_011.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-103042@lists.php.net to get a copy of this message | ||
Commit: 64dad57d198cb9614e55014948f381727185bf72
Author: Dmitry Stogov <dmitry@zend.com> Mon, 10 Sep 2018 15:26:38 +0300
Parents: 27b270de896be6dbe3ce70866421d704cbee4c6f
Branches: PHP-7.3 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=64dad57d198cb9614e55014948f381727185bf72
Log:
Fixed wrong assertion
Changed paths:
M ext/opcache/Optimizer/dfa_pass.c
A ext/opcache/tests/ssa_bug_011.phpt
Diff:
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c
index 07cff98..7e52226 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -704,8 +704,7 @@ optimize_jmpnz:
take_successor_1(ssa, block_num, block);
goto optimize_nop;
}
- } else {
- ZEND_ASSERT(block->successors_count == 2);
+ } else if (block->successors_count == 2) {
if (block->successors[0] == next_block_num) {
take_successor_0(ssa, block_num, block);
if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_UNDEF)) {
@@ -737,8 +736,7 @@ optimize_jmpnz:
opline->extended_value = 0;
opline->opcode = ZEND_JMP;
goto optimize_jmp;
- } else {
- ZEND_ASSERT(block->successors_count == 2);
+ } else if (block->successors_count == 2) {
if (block->successors[0] == block->successors[1]) {
take_successor_0(ssa, block_num, block);
if (block->successors[0] == next_block_num) {
diff --git a/ext/opcache/tests/ssa_bug_011.phpt b/ext/opcache/tests/ssa_bug_011.phpt
new file mode 100644
index 0000000..3c12777
--- /dev/null
+++ b/ext/opcache/tests/ssa_bug_011.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Wrong assertion
+--FILE--
+<?php
+function foo($transitions) {
+ foreach ($transitions as $transition) {
+ if (isEmpty()) {
+ continue;
+ }
+ }
+}
+?>
+OK
+--EXPECT--
+OK