]> granicus.if.org Git - php/commitdiff
Disable eliminatin of empty basic block with multiple predecessors
authorDmitry Stogov <dmitry@zend.com>
Tue, 12 Sep 2017 06:54:45 +0000 (09:54 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 12 Sep 2017 06:54:45 +0000 (09:54 +0300)
ext/opcache/Optimizer/dfa_pass.c
ext/opcache/tests/jmp_elim_003.phpt [new file with mode: 0644]

index ac409301e24893bd03ae096bd7594628ee7f1397..6e914e403b0569c69d29d288d857af276dd96b57 100644 (file)
@@ -578,7 +578,7 @@ static void zend_ssa_replace_control_link(zend_op_array *op_array, zend_ssa *ssa
 
 static void zend_ssa_unlink_block(zend_op_array *op_array, zend_ssa *ssa, zend_basic_block *block, int block_num)
 {
-       if (block->predecessors_count && ssa->blocks[block_num].phis == NULL) {
+       if (block->predecessors_count == 1 && ssa->blocks[block_num].phis == NULL) {
                int *predecessors, i;
 
                ZEND_ASSERT(block->successors_count == 1);
diff --git a/ext/opcache/tests/jmp_elim_003.phpt b/ext/opcache/tests/jmp_elim_003.phpt
new file mode 100644 (file)
index 0000000..55be963
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Incorrect empty basic block elimination
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+    public static function test($args = array()) {
+        if (!function_exists( 'stream_socket_client'))
+            return false;
+
+        $is_ssl = isset( $args['ssl'] ) && $args['ssl'];
+
+        if ($is_ssl) {
+            if (!extension_loaded( 'openssl'))
+                return false;
+            if (!function_exists('openssl_x509_parse'))
+                return false;
+        }
+
+        return apply_filters('use_streams_transport', true, $args);
+    }
+}
+?>
+OK
+--EXPECT--
+OK