vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
1.16k stars 138 forks source link

ReplaceLoop(), If(FindLoop(...)) errors #578

Open jodavies opened 1 week ago

jodavies commented 1 week ago

Syntax errors in these functions don't terminate FORM, so something like

Symbol x;
CFunction f,g,h;
Index i1,...,i3;

Local test =
    + g(i1,i2)*g(i1,i2)
    + g(i1,i2)*g(i1,i3)
    + g(i1,i2,i3)*g(i1,i2,i3)
    + h(i1,i2)*h(i1,i2)
    + h(i1,i2)*h(i1,i3)
    + h(i1,i2,i3)*h(i1,i2,i3)
    ;

ReplaceLoop g, arguments=2, loopsize=2, outfun=f;
ReplaceLoop g, arguments=2, loopsize=2, outfun=f;
ReplaceLoop g, arguments=3, loopsize=2, outfun=f;

If (FindLoop(h, loopsize=1));
    Multiply x;
EndIf;

Print +s;
.end

produces nonsense.

compcomm.c:DoFindLoop should probably just Terminate at the syntax label, and goto it in all error cases and not just some of them.

tueda commented 1 week ago

It seems that error = 1 is missing in DoFindLoop and CoIf (which calls CoFindLoop).