Menu

#3706 lratsusbst causes bind stack overflow on large lists

None
closed
nobody
5
2021-01-21
2021-01-19
Leo Butler
No

A contrived example:

(%i1) load(lrats) $
(%i2) l:makelist(concat('x,i)=concat('x,i+1),i,0,5000) $                
(%i3) lratsubst(l,x0); 
Maxima encountered a Lisp error:
 Condition in MACSYMA-TOP-LEVEL [or a callee]: INTERNAL-SIMPLE-ERROR: Bind stack overflow. 
Automatically continuing. 
To enable the Lisp debugger set *debugger-hook* to nil.   

The problem is due to the use of recursion in ratsubst1and fullratsubst1.

I have attached a patch that re-writes these functions as loops which resolves this problem. The patch includes an iteration limit to prevent infinite loops.

This resolves bug 3376, too.

Leo

1 Attachments

Discussion

  • Robert Dodier

    Robert Dodier - 2021-01-21

    Looks good to me, I think you should go ahead. Maybe put one or more test cases into the share test suite.

     
  • Leo Butler

    Leo Butler - 2021-01-21

    Thanks, Robert.

    This is fixed in commit 864fd56e, including tests and documentation updates.

     
  • Leo Butler

    Leo Butler - 2021-01-21
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB