Control stack exhaustion at compile time in infinitely recursive LABELS w. DYNAMIC-EXTENT

Bug #1738486 reported by Paul F. Dietz on 2017-12-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

(defun f46 (p)
  (let ((s (labels ((%f () (%f))) (if p (%f) 1))))
    (declare (dynamic-extent s))
    (1+ s)))

When evaluated this form causes control stack exhaustion. It works fine if the dynamic-extent declaration is omitted. The (1+ ...) is there to make the scope of s just be the let form; the compiler exhausts the stack even if s is returned.

It seems the analysis for dynamic-extent is running out of control on this pathological local function.

Paul F. Dietz (paul-f-dietz) wrote :

Adding a THROW or ERROR before the recursive call (so the function always terminates) also fails:

(defun f46a (p)
  (let ((s (labels ((%f () (throw 'foo nil) (%f))) (if p (%f) 1))))
    (declare (dynamic-extent s))
    (1+ s)))

Stas Boukarev (stassats) wrote :

In 8158716b415983c6d0c2221edcd4251f6f965563

Changed in sbcl:
status: New → Fix Committed
Stas Boukarev (stassats) on 2017-12-29
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers