Steel Bank Common Lisp

PCL corruption

Reported by Nikodemus Siivola on 2008-12-17
2
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

    (reported by Bruno Haible)
  After the "layout depth conflict" error, the CLOS is left in a state where
  it's not possible to define new standard-class subclasses any more.
  Test case:
  (defclass prioritized-dispatcher ()
    ((dependents :type list :initform nil)))
  (defmethod sb-pcl:validate-superclass ((c1 sb-pcl:funcallable-standard-class)
                                         (c2 (eql (find-class 'prioritized-dispatcher))))
    t)
  (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
    ()
    (:metaclass sb-pcl:funcallable-standard-class))
  ;; ERROR, Quit the debugger with ABORT
  (defclass typechecking-reader-class (standard-class)
    ())
  Expected: #<STANDARD-CLASS TYPECHECKING-READER-CLASS>
  Got: ERROR "The assertion SB-PCL::WRAPPERS failed."

  [ This test case does not cause the error any more. However,
    similar problems can be observed with

    (defclass foo (standard-class) ()
      (:metaclass sb-mop:funcallable-standard-class))
    (sb-mop:finalize-inheritance (find-class 'foo))
    ;; ERROR, ABORT
    (defclass bar (standard-class) ())
    (make-instance 'bar)
  ]

Tags: pcl Edit Tag help
Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Nick Levine (ndl) wrote :

I can't reproduce this.

CL-USER> (defclass foo (standard-class) ()
           (:metaclass sb-mop:funcallable-standard-class))
#<SB-MOP:FUNCALLABLE-STANDARD-CLASS FOO>
CL-USER> (sb-mop:finalize-inheritance (find-class 'foo))
; Evaluation aborted on #<SB-PCL::CPL-PROTOCOL-VIOLATION {5A6C15C9}>.
CL-USER> (defclass bar (standard-class) ())
#<STANDARD-CLASS BAR>
CL-USER> (make-instance 'bar)
#<BAR NIL {5A9B4B21}>
CL-USER>
; No value
CL-USER>
; No value
CL-USER> (defclass prioritized-dispatcher ()
               ((dependents :type list :initform nil)))
#<STANDARD-CLASS PRIORITIZED-DISPATCHER>
CL-USER> (defmethod sb-pcl:validate-superclass ((c1 sb-pcl:funcallable-standard-class)
                                                (c2 (eql (find-class 'prioritized-dispatcher))))
           t)
; Evaluation aborted on #<SB-PCL::CPL-PROTOCOL-VIOLATION {5AB846C9}>.
CL-USER> (defclass prioritized-generic-function (prioritized-dispatcher standard-generic-function)
           ()
           (:metaclass sb-pcl:funcallable-standard-class))
#<SB-MOP:FUNCALLABLE-STANDARD-CLASS PRIORITIZED-GENERIC-FUNCTION>
CL-USER> (defclass typechecking-reader-class (standard-class)
           ())
#<STANDARD-CLASS TYPECHECKING-READER-CLASS>
CL-USER> (lisp-implementation-version)
"1.1.6.14-76e4485-dirty"
CL-USER>

I can reproduce this now, using sbcl-1.1.11.31:

    (defclass foo (standard-class) ()
      (:metaclass sb-mop:funcallable-standard-class))
    (sb-mop:finalize-inheritance (find-class 'foo))
    ;; ERROR, ABORT
    (defclass bar (standard-class) ())
    (make-instance 'bar) ; => ERROR

The error has moved around because of improvements in SB-PCL, and also
because of changes in the point at which finalization is attempted. As
of sbcl-1.1.11.31, I think finalization is fairly eager; the attempt to
make a BAR causes a final-caching-dfun for validate-superclass to be
built, which itself tries to finalize FOO (again), which leads to an
uncaught error regarding the FOO class with its inconsistent
superclass/metaclass.

Changed in sbcl:
status: Confirmed → 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