Wrong binding order of supplied-p parameters in macro lambda lists

Bug #721135 reported by Tamas Papp
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
High
Unassigned

Bug Description

compiling

(defmacro foo (&optional (bar nil bar-p))
  (declare (ignorable bar bar-p)))

gives

; in: DEFMACRO FOO
; (IGNORABLE CL-JAGS::BAR CL-JAGS::BAR-P)
;
; caught STYLE-WARNING:
; declaring unknown variable BAR-P to be ignored
;

Information requested in the bug reporting guidelines:

$ sbcl --version
SBCL 1.0.45
$ uname -a
Linux daedalus 2.6.35-25-generic #44-Ubuntu SMP Fri Jan 21 17:40:44 UTC 2011 x86_64 GNU/Linux
CL-USER> *features*
(:SWANK :QUICKLISP :SB-BSD-SOCKETS-ADDRINFO :ASDF2 :ASDF :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-64 :UNIX :ELF :LINUX :SB-THREAD
 :LARGEFILE :GENCGC :STACK-GROWS-DOWNWARD-NOT-UPWARD :C-STACK-IS-CONTROL-STACK
 :LINKAGE-TABLE :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 :COMPLEX-FLOAT-VOPS :FLOAT-EQL-VOPS :INLINE-CONSTANTS
 :MEMORY-BARRIER-VOPS :OS-PROVIDES-DLOPEN :OS-PROVIDES-DLADDR
 :OS-PROVIDES-PUTWC :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-SUSECONDS-T
 :OS-PROVIDES-GETPROTOBY-R :OS-PROVIDES-POLL)

Tags: ansi
Changed in sbcl:
importance: Undecided → Low
status: New → Triaged
tags: added: ansi
Revision history for this message
Joshua Taylor (joshuaaaron+lp) wrote :

I'm in 1.0.49 and the message is slightly reworded:

CL-USER> (compile nil (lambda ()
                        (destructuring-bind (&optional (x nil xp)) '()
                          (declare (ignore x xp))
                          nil)))
; in: COMPILE ()
; (IGNORE X XP)
;
; caught STYLE-WARNING:
; IGNORE declaration for an unknown variable: XP
;
; compilation unit finished
; caught 1 STYLE-WARNING condition

Stas Boukarev (stassats)
Changed in sbcl:
importance: Low → High
summary: - spurious style warning when ignoring supplied-p parameters in macros
+ Wrong binding order of supplied-p parameters in macro lambda lists
Revision history for this message
Stas Boukarev (stassats) wrote :

I'm not sure how providing output from a 3 year old version is helpful, but I did fix the issue and will commit it after the freeze.

Revision history for this message
Joshua Taylor (joshuaaaron+lp) wrote :

Stas, Thanks for the fix!

I didn't realize the version was that old, but it's what I've got from a not-too-old Ubuntu install. It's a little bit later than the version the original report was filed under at least. This was the bug report I found when searching for the error message, so it's where I posted the output.

On a later version of Ubuntu (which means a debian version of SBCL), I still get the warning:

$ uname -a
Linux hostname 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

CL-USER> (lisp-implementation-version)
"1.1.14.debian"

CL-USER> (lambda ()
           (destructuring-bind (&optional (x nil xp)) '()
             (declare (ignore xp))
             x))
; in: LAMBDA ()
; (IGNORE XP)
;
; caught STYLE-WARNING:
; IGNORE declaration for an unknown variable: XP
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
#<FUNCTION (LAMBDA ()) {100469FD1B}>

Revision history for this message
Stas Boukarev (stassats) wrote :

Found another similar problem with parse-defmacro,
(destructuring-bind (&optional y ((&optional x) y)) '((1)) x) should return 1. Will fix after the freeze as well.

Revision history for this message
Stas Boukarev (stassats) wrote :

In ed063cafbe5a720f30188b996b8ed5e9a8261bf1.

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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