Skip to content

fix: regression: dollar var arguments and TestSub - #918

Open
jodavies wants to merge 2 commits into
form-dev:masterfrom
jodavies:pr-874-regression
Open

jodavies wants to merge 2 commits into
form-dev:masterfrom
jodavies:pr-874-regression

Conversation

@jodavies

Copy link
Copy Markdown
Collaborator

The is a regression due to 13f03ab. Since we have removed intermediate calls of Normalize, SUBEXPRESSIONs can survive in the terms later, when we sort the argument, for example when dollar variables are replaced. Allow such terms, and move the dirty check after this normalize and sort.

Closes #916

@coveralls

coveralls commented Oct 12, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 66.001% — jodavies:pr-874-regression into form-dev:master. No base build found for form-dev:master.

@jodavies

Copy link
Copy Markdown
Collaborator Author

I don't see any performance impact in form-bench due to this.

The is a regression due to 13f03ab. Since we have removed intermediate calls of
Normalize, SUBEXPRESSIONs can survive in the terms later, when we sort the
argument, for example when dollar variables are replaced. Allow such terms,
and move the dirty check after this normalize and sort.
Similarly to a fix in form-dev#874, we must not call Normalize in-place in the
TestSub recursion. Remove such a call, in the case of DENOMINATOR and
EXPONENT functions when they are inside function arguments. Otherwise,
for example replace_ functions, destroy term data or fail to propagate
size book-keeping through the nesting stack.

Rely on the call of Normalize before sorting, which uses a copy of the
term data.
@jodavies

Copy link
Copy Markdown
Collaborator Author

The second commit removes another in-place Normalize, which causes hangs or crashes with scripts like

Symbol a,b;
CFunction f;
Local test = f(1/(a+b));
Multiply replace_(a,1,b,2);
Print;
.end

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.

Crash in formerly valid replacement

2 participants