Skip to content

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

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

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

Conversation

@iliaal

@iliaal iliaal commented Oct 3, 2026

Copy link
Copy Markdown
Owner

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 php#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
@iliaal

iliaal commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

Promoted to php#24110.

@iliaal iliaal closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Range inference optimizer bug

1 participant