Skip to content

Detect phi cycles in PhiMatcher::Find and PhiMatcher::Final. - #400

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/1005116724
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/1005116724

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Detect phi cycles in PhiMatcher::Find and PhiMatcher::Final.

PhiMatcher::Find and PhiMatcher::Final followed phi transitions until a match or final weight was found, checking only for a single-state phi self-loop (nextstate == s). A phi cycle of two or more states (or a phi self-loop in Find when phi_loop is false) caused an infinite loop in both fatal and non-fatal error modes.

Detect phi cycles in PhiMatcher::Find and PhiMatcher::Final using Brent's O(1)-space cycle detection algorithm (Richard P. Brent, "An improved Monte Carlo factorization algorithm," BIT Numerical Mathematics, 20(2):176-184, 1980), report FSTERROR() and set error_ = true when a phi cycle is encountered, and stop following phi self-loops in Find when phi_loop_ is false.

@copybara-service
copybara-service Bot force-pushed the copybara/1005116724 branch 4 times, most recently from 2d3cf3d to f7f595a Compare October 23, 2026 16:43
`PhiMatcher::Find` and `PhiMatcher::Final` followed phi transitions until a match or final weight was found, checking only for a single-state phi self-loop (`nextstate == s`). A phi cycle of two or more states (or a phi self-loop in `Find` when `phi_loop` is `false`) caused an infinite loop in both fatal and non-fatal error modes.

Detect phi cycles in `PhiMatcher::Find` and `PhiMatcher::Final` using Brent's O(1)-space cycle detection algorithm (Richard P. Brent, "An improved Monte Carlo factorization algorithm," *BIT Numerical Mathematics*, 20(2):176-184, 1980), report `FSTERROR()` and set `error_ = true` when a phi cycle is encountered, and stop following phi self-loops in `Find` when `phi_loop_` is `false`.

PiperOrigin-RevId: 1005116724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant