sb-c::find-original-source gets confused by macros that destructively modify their arguments

Bug #1371719 reported by 3b
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

;; in foo.lisp
(defmacro a1 (a)
  (print `(,(car a) ,(cadr a) ,(caddr a) (lambda () (block foo . ,(cdddr a))))))

(defmacro a2 (a)
  (setf (cdddr a) `((lambda () (block foo . ,(cdddr a)))))
  (print a))

(defmacro b (a) `(let ((a)) ,a))

(a1 (defun foo1 () (b (progn (/ 1 0)))))
(a2 (defun foo2 () (b (progn (/ 1 0)))))

;; at REPL
(compile-file "foo.lisp")

;; ->

debugger invoked on a SB-INT:BUG in thread
#<THREAD "main thread" RUNNING {10039CEA93}>:
    failed AVER: (NULL CURRENT)
  This is probably a bug in SBCL itself. (Alternatively, SBCL might have been
  corrupted by bad user code, e.g. by an undefined Lisp operation like
  (FMAKUNBOUND 'COMPILE), or by stray pointers from alien code or from unsafe
  Lisp code; or there might be a bug in the OS or hardware that SBCL is running
  on.) If it seems to be a bug in SBCL itself, the maintainers would like to
  know about it. Bug reports are welcome on the SBCL mailing lists, which you
  can find at <http://sbcl.sourceforge.net/>.

The A2 macro is non-conformant since it modifies its literal arguments, but it would be nicer to just give up on finding the source location and print the original warning instead of getting a failed AVER. Alternately, a nicer message that suggests the possibility of destructive modification of literals in source and includes original warning.

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.