Problems with DXing the results of a local function

Bug #1659964 reported by Douglas Katzman on 2017-01-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
High
Unassigned

Bug Description

Followup to https://bugs.launchpad.net/sbcl/+bug/1530390 which removed dxification of RESTARTs as a workaround.
RESTART-BIND is not able to use DX restart objects.

* (sb-int:clear-info :function :inlinep 'sb-kernel:make-restart) ; remove NOTINLINE-ness
* (setf (extern-alien "pre_verify_gen_0" int) 1)
* (defparameter *f*
  (compile
   nil
   '(lambda (arg)
      (declare (optimize (speed 3) (space 0) (safety 0)))
      (sb-ext:gc :full t) ; will verify the heap
      (restart-case (write-string #.(format nil "Foo!~%") t)
        (use-value (other) other)
        (retry () arg))
      (write-string #.(format nil "After RESTART-CASE~%") t)
      (sb-ext:gc :full t))))

* (funcall *f* "")
Foo!
After RESTART-CASE

NIL

* (funcall *f* "")
CORRUPTION WARNING in SBCL pid 32349(tid 140737353951040):
Memory fault at 0x1f8e (pc=0x21d3d491, sp=0x7ffff5a178e3)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.

Stas Boukarev (stassats) wrote :

This is actually do to DXing results of local functions
(defun bar ())

(defun foo ()
  (declare (optimize (speed 3)))
  (flet ((x () (cons 1 2)))
    (let ((x (x))
          (y (x)))
      (declare (dynamic-extent x y))
      (print (list x y))))
  (bar)
  (sb-ext:gc :full t))

(foo)

=>
no transport function for object 0x10023a3daf (widetag 0xb2)

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb>

summary: - miscompilation of restart-bind if RESTART is dxified
+ Problems with DXing the results of a local function
Changed in sbcl:
importance: Undecided → High
status: New → Triaged
Stas Boukarev (stassats) wrote :

And this is a problem with stack analysis, they conses are not actually dxed, but it inserts %pop-values.

tags: added: stack-analysis
Stas Boukarev (stassats) wrote :

Simplified
(defun foo ()
  (declare (optimize (speed 3)))
  (flet ((x () (cons 1 2)))
    (declare (notinline x))
    (let ((x (x)))
      (declare (dynamic-extent x))
      (print x)))
  (bar)
  (sb-ext:gc :full t))

Stas Boukarev (stassats) wrote :

In 295da4f7bd1698ac847a6196c24d51523e1e659b.

Changed in sbcl:
status: Triaged → Fix Committed
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