...to the block tree, which it would do (causing a "maximum recursion
depth exceeded" abort during block->dbg-block) when compiling crazy
code like:
(define (fubar param)
(define (closure) param)
(define (loop)
(closure)
(loop)
;; It doesn't break without this
(tail-call)))
(fubar sumpn)
This patch checks that the "Acceptable substitute" for a block's
stack-link is not inside the block.
parent
;; Acceptable substitute: we're a subproblem of someone
- ;; who is a child of the parent.
+ ;; who is a child of the parent (but not a subproblem of
+ ;; ourselves!).
(let ((value (lvalue-known-value lvalue)))
(and value
- (let ((block (continuation/block value)))
- (and (block-ancestor? block parent)
- block))))))))
+ (let ((link (continuation/block value)))
+ (and (block-ancestor? link parent)
+ (not (block-ancestor-or-self? link block))
+ link))))))))
\f
(define (setup-block-static-links! blocks)
(for-each