Skip to content

branch elimination in _n_formulaic#869

Merged
pkova merged 1 commit intonext/kelvin/409from
dozreg/formulaic-branch-elimination
Sep 19, 2025
Merged

branch elimination in _n_formulaic#869
pkova merged 1 commit intonext/kelvin/409from
dozreg/formulaic-branch-elimination

Conversation

@dozreg-toplud
Copy link
Copy Markdown
Contributor

@dozreg-toplud dozreg-toplud commented Sep 2, 2025

I realized that branch elimination introduced in #850 led to crashes like in this example:

.*(0 [%6 [%5 [%0 1] %1 0] [%1 42] [%6 [%1 %0] [%0 0 0] [%1 42]]])

When outer %6 is compiled, _n_formulaic checks the validity of formulas in branches, replacing them with single BAIL instruction if the formula is malformed, which would make it always crash. From POV of _n_formulaic inner %6 is valid, since the condition expression and at least one of the branch expressions are valid. But when inner %6 is compiled, we only compile the invalid branch due to branch elimination, leading to a crash.

For that reason _n_formulaic has to be more strict in the presence of branch elimination.

@dozreg-toplud dozreg-toplud requested a review from a team as a code owner September 2, 2025 13:08
@dozreg-toplud dozreg-toplud requested a review from joemfb September 2, 2025 18:54
@pkova pkova merged commit 5773075 into next/kelvin/409 Sep 19, 2025
2 checks passed
@pkova pkova deleted the dozreg/formulaic-branch-elimination branch September 19, 2025 15:43
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.

3 participants