diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 8e082142868..daa945c3908 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -7114,19 +7114,19 @@ static int zend_jit_cmp(dasm_State **Dst, (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))); if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) { - if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) { if (op1_info & MAY_BE_DOUBLE) { | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >4, ZREG_TMP1 } else { | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9, ZREG_TMP1 } } - if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_LONG))) { + if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))) { if (op2_info & MAY_BE_DOUBLE) { | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >3, ZREG_TMP1 |.cold_code |3: - if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9, ZREG_TMP1 } if (!zend_jit_cmp_long_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { @@ -7144,11 +7144,11 @@ static int zend_jit_cmp(dasm_State **Dst, if (op1_info & MAY_BE_DOUBLE) { |.cold_code |4: - if (op1_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) { | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9, ZREG_TMP1 } if (op2_info & MAY_BE_DOUBLE) { - if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) { + if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) { if (!same_ops) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >5, ZREG_TMP1 } else { @@ -7162,7 +7162,7 @@ static int zend_jit_cmp(dasm_State **Dst, } if (!same_ops) { |5: - if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) { | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9, ZREG_TMP1 } if (!zend_jit_cmp_double_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { @@ -7175,11 +7175,11 @@ static int zend_jit_cmp(dasm_State **Dst, } else if ((op1_info & MAY_BE_DOUBLE) && !(op1_info & MAY_BE_LONG) && (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) { - if (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE)) { | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9, ZREG_TMP1 } if (op2_info & MAY_BE_DOUBLE) { - if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) { + if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) { if (!same_ops && (op2_info & MAY_BE_LONG)) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >3, ZREG_TMP1 } else { @@ -7195,7 +7195,7 @@ static int zend_jit_cmp(dasm_State **Dst, |.cold_code } |3: - if (op2_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_DOUBLE|MAY_BE_LONG))) { | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9, ZREG_TMP1 } if (!zend_jit_cmp_double_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { @@ -7209,11 +7209,11 @@ static int zend_jit_cmp(dasm_State **Dst, } else if ((op2_info & MAY_BE_DOUBLE) && !(op2_info & MAY_BE_LONG) && (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) { - if (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE)) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9, ZREG_TMP1 } if (op1_info & MAY_BE_DOUBLE) { - if (!same_ops && (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) { + if (!same_ops && (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) { if (!same_ops && (op1_info & MAY_BE_LONG)) { | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >3, ZREG_TMP1 } else { @@ -7229,7 +7229,7 @@ static int zend_jit_cmp(dasm_State **Dst, |.cold_code } |3: - if (op1_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_DOUBLE|MAY_BE_LONG))) { | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9, ZREG_TMP1 } if (!zend_jit_cmp_long_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 40efcef2b97..e9c615f9b27 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -7648,19 +7648,19 @@ static int zend_jit_cmp(dasm_State **Dst, (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))); if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) { - if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) { if (op1_info & MAY_BE_DOUBLE) { | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >4 } else { | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9 } } - if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_LONG))) { + if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))) { if (op2_info & MAY_BE_DOUBLE) { | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >3 |.cold_code |3: - if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9 } if (!zend_jit_cmp_long_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { @@ -7678,11 +7678,11 @@ static int zend_jit_cmp(dasm_State **Dst, if (op1_info & MAY_BE_DOUBLE) { |.cold_code |4: - if (op1_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) { | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9 } if (op2_info & MAY_BE_DOUBLE) { - if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) { + if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) { if (!same_ops) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >5 } else { @@ -7696,7 +7696,7 @@ static int zend_jit_cmp(dasm_State **Dst, } if (!same_ops) { |5: - if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) { | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9 } if (!zend_jit_cmp_double_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { @@ -7709,11 +7709,11 @@ static int zend_jit_cmp(dasm_State **Dst, } else if ((op1_info & MAY_BE_DOUBLE) && !(op1_info & MAY_BE_LONG) && (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) { - if (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE)) { | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9 } if (op2_info & MAY_BE_DOUBLE) { - if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) { + if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) { if (!same_ops && (op2_info & MAY_BE_LONG)) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >3 } else { @@ -7729,7 +7729,7 @@ static int zend_jit_cmp(dasm_State **Dst, |.cold_code } |3: - if (op2_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_DOUBLE|MAY_BE_LONG))) { | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9 } if (!zend_jit_cmp_double_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { @@ -7743,11 +7743,11 @@ static int zend_jit_cmp(dasm_State **Dst, } else if ((op2_info & MAY_BE_DOUBLE) && !(op2_info & MAY_BE_LONG) && (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) { - if (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) { + if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE)) { | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9 } if (op1_info & MAY_BE_DOUBLE) { - if (!same_ops && (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) { + if (!same_ops && (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_DOUBLE))) { if (!same_ops && (op1_info & MAY_BE_LONG)) { | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >3 } else { @@ -7763,7 +7763,7 @@ static int zend_jit_cmp(dasm_State **Dst, |.cold_code } |3: - if (op1_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) { + if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_DOUBLE|MAY_BE_LONG))) { | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9 } if (!zend_jit_cmp_long_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2, exit_addr)) { diff --git a/ext/opcache/tests/jit/cmp_006.phpt b/ext/opcache/tests/jit/cmp_006.phpt new file mode 100644 index 00000000000..aeaab458520 --- /dev/null +++ b/ext/opcache/tests/jit/cmp_006.phpt @@ -0,0 +1,57 @@ +--TEST-- +JIT CMP: 006 Undefined variable checks +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=1M +opcache.protect_memory=1 +--FILE-- + +--EXPECTF-- +Warning: Undefined variable $x in %s on line %d +bool(false) + +Warning: Undefined variable $x in %s on line %d +bool(false) + +Warning: Undefined variable $y in %s on line %d +bool(false) + +Warning: Undefined variable $y in %s on line %d +bool(false)