Skip to content

fix: give each SORTING struct its own OldPosOut, OldPosIn#843

Open
jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:fix-term-arg-stagesort
Open

fix: give each SORTING struct its own OldPosOut, OldPosIn#843
jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:fix-term-arg-stagesort

Conversation

@jodavies

@jodavies jodavies commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

During a ground-level stage sort, if a sub-buffer par=1 MergePatches creates a sort file, it resets OldPosOut with PUTZERO(AN.OldPosOut);. The value of OldPosOut needed by the ground-level sort is lost, leading to terms being lost due to not finishing the Merge by jumping to ConMer, at the end of MergePatches.

Fix by moving OldPosOut, OldPosIn to the SORTING struct. Now every sort has its own private values.

This is a nasty one: users who have run scripts which they know caused both ground-level stage sorts and very nasty sub-buffer sorts (which created sort files) should be suspicious of the results!

During a ground-level stage sort, if a sub-buffer par=1 MergePatches creates
a sort file, it resets OldPosOut with `PUTZERO(AN.OldPosOut);`. The value
of OldPosOut needed by the ground-level sort is lost, leading to terms
being lost due to not finishing the Merge by jumping to ConMer, at the end
of MergePatches.

Fix by moving OldPosOut, OldPosIn to the SORTING struct. Now every sort has
its own private values.

This is a nasty one: users who have run scripts which they know caused both
ground-level stage sorts and very nasty sub-buffer sorts (which created sort
files) should be suspicious of the results!
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 62.792% (-0.01%) from 62.803% — jodavies:fix-term-arg-stagesort into form-dev:master

@jodavies

Copy link
Copy Markdown
Collaborator Author

This also looks good if you test a "nested version" like

* Generate enough terms in a sub-buffer sort to create a sort file:
Argument f;
   Identify f(x?) = sum_(j,1,`BLOWUP',f(x)/`BLOWUP');
   Argument f;
      Identify x^i?pos_ = sum_(j,1,`BLOWUP',x^i*i/`BLOWUP');
   EndArgument;
   Identify f(x?) = x;
EndArgument;

but it takes too long for the CI.

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.

2 participants