[CM] Segmentation fault in s7 triggered by recursive expression
Jim Zhou
jimzhouzzy at gmail.com
Mon Jul 14 04:47:06 PDT 2025
Hi,
I’ve encountered a segmentation fault in s7 triggered by the following code:
```
;; This is a `filter` function from SRFI-1
(define (filter pred l)
(let recur ((l l))
(if (null? l) l
(let ((head (car l))
(tail (cdr l)))
(if (pred head)
(let ((new-tail (recur tail)))
(if (eq? tail new-tail) l
(cons head new-tail)))
(recur tail))))))
(define func (lambda (x) #t))
(filter func (make-list 100000 1))
```
I’ve looked into it a bit. When s7 is compiled with `S7_DEBUGGING=1`, the issue doesn’t occur—presumably because an additional `resize_stack_unchecked` call is made before actually `push_stack`, which seems to prevent the crash.
Let me know if you’d like any additional info or if I can help further.
Regards,
Jim Zhou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20250714/1fd255e4/attachment.html>
More information about the Cmdist
mailing list