problem with backtraces with DX rest and type-errors from THE

Bug #795245 reported by Nikodemus Siivola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

   (defun oops (x &rest args)
     (declare (dynamic-extent args))
     (the number x)
     (length args))

   (oops nil 1)

=>

debugger invoked on a TYPE-ERROR: The value NIL is not of type NUMBER.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

debugger invoked on a TYPE-ERROR:
  The value #<invalid object #x11FF4C7> is not of type SEQUENCE.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(REVERSE #<invalid object #x11FF4C7>)[:EXTERNAL]
0[2]

The error occurs trying to reverse the rest-list -- which isn't what the debugger expect it to be.

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Changing the THE to (DECLARE (NUMBER X)) makes things come out right.

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Workaround committed. The actual issue of invalid object where the &rest should be remains.

commit bddb383d464b924f1066f1733fe8e2407e7d9283
Author: Nikodemus Siivola <email address hidden>
Date: Thu Jun 9 23:23:23 2011 +0300

    robustify debugger against bogus lambda-lists

      If we don't find a list where we expect a rest-list to be,
      substitute a dummy unprintable object.

      Provides a workaround for lp#795245.

Changed in sbcl:
importance: Undecided → Medium
status: New → Triaged
tags: added: compiler debugger dynamic-extent
Changed in sbcl:
importance: Medium → Low
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Of the following, BAR and ZOT exhibit the problem.

(defun bar (x &rest args)
  (declare (dynamic-extent args))
  (values (the number x) (length args)))

(defun zot (x &rest args)
  (declare (dynamic-extent args))
  (locally
      (declare (number x))
    (values x (length args))))

(defun foo (x &rest args)
  (values (the number x) (length args)))

(defun quux (x &rest args)
  (declare (dynamic-extent args))
  (declare (number x))
  (values x (length args)))

(defun fii (x &rest args)
  (declare (dynamic-extent fii))
  (if x
      (error "foo")
      (length args)))

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.