1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/gh19679.phpt
Arnaud Le Blanc bd88a54934 Ensure that type widening converges
Range analysis may fail to converge (the process hangs) when the transfer
function zend_inference_calc_range produces a smaller range.

Fix by ensuring that the widening operator zend_inference_widening_meet
allows only widening. This matches the inference rules in figure 13 of the
paper.

Fixes GH-19679
Closes GH-19683
2025-09-04 08:58:06 +02:00

23 lines
363 B
PHP

--TEST--
GH-19679: zend_ssa_range_widening does not converge
--SKIPIF--
<?php
if (PHP_INT_SIZE !== 8) {
die('skip output depends PHP_INT_SIZE=8');
}
?>
--FILE--
<?php
function test() {
$a = PHP_INT_MIN+1;
$b = 0;
while ($b++ < 3) {
$a = (int) ($a-- - $b - 1);
}
return $a;
}
var_dump(test() == PHP_INT_MIN);
?>
--EXPECT--
bool(true)