php / php-src

The PHP Interpreter
https://www.php.net
Other
38.13k stars 7.74k forks source link

Core dumped in Zend/Optimizer/zend_inference.c:4062 #15821

Closed YuanchengJiang closed 1 month ago

YuanchengJiang commented 1 month ago

Description

The following code:

<?php
    $allInternalFunctions = array();
    $definedFunctions = get_defined_functions();
    $internalFunctions = $definedFunctions['internal'];
    $allInternalFunctions = array_merge($allInternalFunctions, $internalFunctions);
    $allInternalFunctions = array_filter($allInternalFunctions, function($func) {
        strpos($func, 'posix_') !== 0;
    });
?>

Resulted in this output:

/php-src/Zend/Optimizer/zend_inference.c:4062: zend_result _zend_update_type_info(const zend_op_array *, zend_ssa *, const zend_script *, zend_bitset, const zend_op *, zend_ssa_op *, const zend_op **, zend_long, _Bool): Assertion `ssa_opcodes != ((void*)0) || __ssa_var->var >= op_array->last_var || (ssa_var_info[__var].type & (1 << 10)) == (__type & (1 << 10))' failed.
Aborted (core dumped)

To reproduce:

-d "extension_dir=/php-src/modules/" -d "zend_extension=/php-src/modules/opcache.so" -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=1033"

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

dstogov commented 1 month ago

This is caused by incorrect type inference for ZEND_FRAMELESS_ICALL_N. In general, this assertion might be triggered with function and tracing jit as well. I'll take care.