wanted: warnings about invalid usage of the variables which are declared to be within dynamic extent

Bug #589305 reported by Roman Marynchak on 2010-06-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

SBCL 1.0.38. This code:

(defun f ()
 (let ((x (list 1 2 3)))
         (declare (dynamic-extent x))
          x))

should warn the user about the invalid return of the stack-allocated variable X on compile time.

Regards,
Roman

Changed in sbcl:
status: New → Confirmed
James Y Knight (foom) wrote :

Yeah, that'd be really nice if it could figure out that the variable certainly doesn't have dynamic extent and tell you that you've screwed up.

Conversely, it would be nice if it could figure out that a variable certainly *is* dynamic-extent, and not require an explicit declaration. E.g. in:

(defun stupid+ (a b c)
(let ((x (list a b c)))
 (reduce #'+ x))

it would be nice if it could automatically deduce that x can be stack allocated, because it knows it can't escape.

I agree with the reverse problem, but it is the completely different task from the implementation point of view. So, please report it as a separate issue, because in other case we will not be able to tell what is the progress on the first and on the second ones.

Changed in sbcl:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers