fdo 37341 MAXRECURSION reached in ScFormulaCell::Interpret
W.Donkers at dci-electronics.nl
Wed Jul 24 02:34:27 PDT 2013
> I presume it is the combination of BackSolver iteration and recursion.
> Setting an error if MAXRECURSION is reached is not appropriate.
> That thing is a beast and time consuming to debug. To understand what
> it does it would help to set MAXRECURSION to 5 or so and have a few
> more simple recursing formula cells to step through. (A9:=A8 A8:=A7
> Setting up a simple BackSolver scenario that kicks in badly with the
> reduced limit might be equally challenging..
Well, after a short break (after all, it's summer here) I resumed work on this problem.
I set MAXRECURSION to 4, made a simple spreadsheet (A2:=A1+1, A3:=A2=1, etc.) and started 'Goal Seeking'.
With the target at A5 and the variable cell at A1, the recursion count reached 4 every time Interpret() was called from BackSolver(); BackSolver() was called once and a valid solution was found (as expected).
With the target at A6 and the variable cell at A1, the recursion count reached 5 every time Interpret() was called from BackSolver(); Interpret() was called a zillion times and I aborted the application (more or less as expected).
I changed a littel bit in the code of ScFormulaCell::Interpret():
if (rRecursionHelper.GetRecursionCount() > MAXRECURSION)
bRunning = true;
return; //line added for testing
I changed this so that Interpret does not continue its recursive work, as it seems to do.
With the target at A6 and the variable cell at A1, the recursion count reached 5, Interpret() was called once from BackSolver(); BackSolver() was called twice; Goal Seek reported a failure (circular reference), but (better than expected).
To me, it _seems_ as if reaching the maximum recusrion count is not handled correctly in ScFormulaCell::Interpret().
Before I start digging in the wrong direction and messing up things that I shouldn't touch I would very much like your expert opinion ;-)
More information about the LibreOffice