fmakunbound fails for macros in SBCL 1.0.49

Bug #795705 reported by Matt Kaufmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
High
Unassigned

Bug Description

Quoting the CL Hyperspec on fmakunbound:

     Removes the function or macro definition, if any, of name in the global environment.

This worked in SBCL 1.0.45 but fails in 1.0.49. Here are logs for
64-bit linux.

; 1.0.45 (worked)

  * (defmacro foo (x) x)

  FOO
  * (fmakunbound 'foo)

  FOO
  * (macro-function 'foo)

  NIL
  *

; 1.0.49 (failed)

  * (defmacro foo (x) x)

  FOO
  * (fmakunbound 'foo)

  FOO
  * (macro-function 'foo)

  #<FUNCTION (MACRO-FUNCTION FOO) {AABD50D}>
  *

Other info requested for a bug report:

sloth:~> ~/bin/sbcl --version
SBCL 1.0.49
sloth:~> uname -a
Linux sloth 2.6.32-32-server #62-Ubuntu SMP Wed Apr 20 22:07:43 UTC 2011 x86_64 GNU/Linux
sloth:~> ~/bin/sbcl
This is SBCL 1.0.49, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* *features*

(:ANSI-CL :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS
 :SB-UNICODE :SB-EVAL :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT :X86 :UNIX :ELF
 :LINUX :SB-THREAD :LARGEFILE :GENCGC :STACK-GROWS-DOWNWARD-NOT-UPWARD
 :C-STACK-IS-CONTROL-STACK :COMPARE-AND-SWAP-VOPS :UNWIND-TO-FRAME-AND-CALL-VOP
 :RAW-INSTANCE-INIT-VOPS :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-VECTORS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-FIXED-OBJECTS :ALIEN-CALLBACKS
 :CYCLE-COUNTER :INLINE-CONSTANTS :MEMORY-BARRIER-VOPS :LINKAGE-TABLE
 :OS-PROVIDES-DLOPEN :OS-PROVIDES-DLADDR :OS-PROVIDES-PUTWC
 :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-SUSECONDS-T :OS-PROVIDES-GETPROTOBY-R
 :OS-PROVIDES-POLL)
*

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

commit 39c9c1d494f6d8a42c6f701ef1db4f688fe1b310
Author: Nikodemus Siivola <email address hidden>
Date: Fri Jun 10 23:30:52 2011 +0300

    FMAKUNBOUND removes the MACRO-FUNCTION as well

      Fixes lp#795705.

Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Revision history for this message
Matt Kaufmann (kaufmann) wrote :

Thank you for fixing this so quickly!

Is there a bit of code I can put into my sources that works around this
problem? (Otherwise, I'll need to disallow builds of ACL2 on SBCL
1.0.49.)

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

;;; Untested, but should work

(in-package :sb-c)

(without-package-locks

(defun undefine-fun-name (name)
  (when name
    (macrolet ((frob (type &optional val)
                 `(unless (eq (info :function ,type name) ,val)
                    (setf (info :function ,type name) ,val))))
      (frob :info)
      (frob :type (specifier-type 'function))
      (frob :where-from :assumed)
      (frob :inlinep)
      (frob :kind)
      (frob :macro-function)
      (frob :inline-expansion-designator)
      (frob :source-transform)
      (frob :structure-accessor)
      (frob :assumed-type)))
  (values))

)

Revision history for this message
Matt Kaufmann (kaufmann) wrote : Re: [Bug 795705] Re: fmakunbound fails for macros in SBCL 1.0.49

>> ;;; Untested, but should work

Thank you! That does the trick.

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