From: Barton W. <wil...@us...> - 2025-10-10 10:16:21
|
Maybe not a fix, but the bug vanishes by inserting a trap for when `x` and `e` are syntactically equal at the top of `infsimp2`. The argument names to `infsimp2` are misleading, I think. The first argument to `infsimp2` is `expand(e,1,1)`; it is not a limit variable as the name `x` suggests. When `x` and `e` are syntactically equal, the call `(setq x ($limit x))` in `infsimp2` causes an infinite loop. A revised function: ~~~ (defun infsimp2 (x e) (cond ((alike1 x e) e) (t (setq x ($limit x)) (if (isinop x '%limit) e x)))) ~~~ This change to `infsimp2` seems harmless, but I'm not sure it it is really getting at the bug. Possibly the check `(alike1 x e)` should be moved up to `infsimp` but I didn't try that. Also, possibly `infsimp` should send all relational expressions directly to `infsimp2`, not just equal: ~~~ (defun infsimp (e) (let ((x ($expand e 1 1))) (cond ((or (not (free x '$ind)) (not (free x '$und)) (not (free x '$zeroa)) (not (free x '$zerob)) (not (free x '$infinity)) (mbagp x) (mrelationp x)) ;; <=== New (infsimp2 x e)) ((and (free x '$inf) (free x '$minf)) x) (t (infsimp1 x e))))) ~~~ --- **[bugs:#4619] limit(inf = inf) causes stack overflow** **Status:** open **Group:** None **Labels:** limit **Created:** Thu Oct 09, 2025 06:22 PM UTC by Robert Dodier **Last Updated:** Thu Oct 09, 2025 06:22 PM UTC **Owner:** nobody Looking at bug report #4603, looks like it is triggered by a bug in `limit`. Here is the simplest case I found: ``` (%i1) limit(inf=inf); INFO: Binding stack guard page unprotected Binding stack guard page temporarily disabled: proceed with caution debugger invoked on a SB-KERNEL::BINDING-STACK-EXHAUSTED in thread #<THREAD tid=4380 "main thread" RUNNING {1001760003}>: Binding stack exhausted. ``` This other example also causes a stack overflow: `limit(minf = minf)`. Bug #4603 is triggered by `limit(foo - inf = -inf)`, where `foo` is a gensym (and the bug is also triggered when `foo` is just `foo`). Looks like the stack overflow originates in INFSIMP2. I didn't investigate beyond that. When this bug gets fixed, we should go back to #4603 and verify that bug is also fixed. --- Sent from sourceforge.net because max...@li... is subscribed to https://sourceforge.net/p/maxima/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/maxima/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |