Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940 #17438

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,8 +2622,8 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
/* THROW and EXIT may be used in the middle of BB */
/* don't generate code for the rest of BB */

/* Skip current opline for call_level computation
* Don't include last opline because end of loop already checks call level of last opline */
/* Skip current opline for call_level computation because it does not influence call_level.
* Don't include last opline because end of loop already checks call level of last opline. */
i++;
for (; i < end; i++) {
opline = op_array->opcodes + i;
Expand All @@ -2633,7 +2633,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
call_level--;
}
}
opline = op_array->opcodes + i;
opline = op_array->opcodes + end;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be you should fix only this single line?

- opline = op_array->opcodes + i;
+ opline = op_array->opcodes + end;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

break;
/* stackless execution */
case ZEND_INCLUDE_OR_EVAL:
Expand Down
35 changes: 35 additions & 0 deletions ext/opcache/tests/jit/gh17428.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--TEST--
GH-17428 (Assertion failure ext/opcache/jit/zend_jit_ir.c:8940)
--EXTENSIONS--
opcache
--INI--
opcache.jit=1205
--FILE--
<?php
new EmptyIterator();
srand(1000);
error_reporting(E_ALL);
testConversion('', '');
testConversion('', '');
testConversion('', '');
testConversion('', '');
testConversion('', '');
function testRoundTrip($data) {
}
for ($iterations = 0; $iterations < 100; $iterations++) {
$strlen = rand(1, 100);
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randstring = '';
for ($i = 0; $i < $strlen; $i++) {
$randstring .= $characters[rand(0, strlen($characters) - 1)];
}
die($randstring);
}
echo "Done!\n";
throw new Hello(new stdClass);
?>
--EXPECTF--
Fatal error: Uncaught Error: Call to undefined function testConversion() in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
Loading