Skip to content

ext/opcache: Fix GH-24088 integer range propagation - #24110

Open
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-24088-integer-range-inference
Open

iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-24088-integer-range-inference

Conversation

@iliaal

@iliaal iliaal commented Oct 4, 2026

Copy link
Copy Markdown
Member

Integer ranges from comparisons only constrain integer inputs. Track numeric operand types with a lightweight worklist before range inference so casts, arithmetic, symbolic comparisons, and typed-reference assignments cannot reuse incompatible bounds. This prevents values such as 5.5 and true from being folded to 6 while retaining a single full type-inference pass. Some symbolic loop bounds derived from arithmetic remain less precise because the preliminary type information cannot use range-dependent integer certainty. Fixes #24088.

Track numeric operand types before range inference with a lightweight worklist.
Coercions and symbolic constraints must not reuse bounds that apply only to
integer inputs. Guard casts, arithmetic, increment/decrement, and assignments
through typed references, then run full type inference using the valid ranges.

Fixes phpGH-24088
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Range inference optimizer bug

1 participant