Steel Bank Common Lisp

bogus lack of style warning with non-empty symbol-macrolet

Reported by Jan Moringen on 2012-01-31
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

A description of what you do, what happens, and what you expected to happen:

When compiling a lambda containing an empty macrolet containing an ignorable declaration, the compiler produces a seemingly bogus style-warning which refers to the declaration. The compiler should not produce such bogus warnings. The warning disappears when the macrolet has one or more bindings.

A complete repeatable test-case (also at http://paste.lisp.org/display/127388):

* (compile nil `(lambda (a) (symbol-macrolet ((b 1))
      (declare (ignorable a))
      :c)))
#<FUNCTION (LAMBDA (A)) {100DA7F9FB}>
NIL
NIL

* (compile nil `(lambda (a) (symbol-macrolet ()
      (declare (ignorable a))
      :c)))
; in: LAMBDA (A)
; (IGNORABLE A)
;
; caught STYLE-WARNING:
; IGNORABLE declaration for an unknown variable: A

; (LAMBDA (A)
; (SYMBOL-MACROLET ()
; (DECLARE (IGNORABLE A))
; :C))
;
; caught STYLE-WARNING:
; The variable A is defined but never used.
;
; compilation unit finished
; caught 2 STYLE-WARNING conditions
#<FUNCTION (LAMBDA (A)) {100E6DB98B}>
T
NIL

SBCL version as reported by "sbcl --version":

SBCL 1.0.55

Output from uname -a:

Linux azurit 2.6.35-30-generic #53-Ubuntu SMP Sun Jun 5 04:00:23 UTC 2011 x86_64 GNU/Linux

*FEATURES*:

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

Jan Moringen (scymtym) on 2012-01-31
description: updated
Stas Boukarev (stassats) wrote :

IGNORABLE is a bound declaration, it should appear directly after the form which introduces a binding. It should be
(lambda (a)
  (declare (ignorable a))
  (symbol-macrolet ()
    :c))

Changed in sbcl:
status: New → Invalid

 summary "bogus lack of style warning with non-empty symbol-macrolet"
 status confirmed
 done

Something got mangled. The original report was at
<http://paste.lisp.org/display/127388>, and the problem I saw in it was:

 CL-USER> (compile nil `(lambda (a) (symbol-macrolet ((b 1))
                                      (declare (ignorable a))
                                      :c)))
 #<FUNCTION (LAMBDA (A)) {100DA7F9FB}>
 NIL
 NIL

with no style-warnings, in contrast with the empty symbol-macrolet which
does correctly give the style warning.

Christophe

summary: - Bogus style-warning caused by declarations within empty macrolet
+ bogus lack of style warning with non-empty symbol-macrolet
Changed in sbcl:
status: Invalid → Confirmed
Nikodemus Siivola (nikodemus) wrote :

Ouch. MAKE-LEXENV uses NCONC on it's argument.

Replacing things with APPEND seems to take care of this... remains to be seen if anything breaks by doing that.

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
importance: Undecided → Medium
status: Confirmed → In Progress
Nikodemus Siivola (nikodemus) wrote :

commit 09cbe389732a42a2eaeaa5fbe3847a95a10c996e
Author: Nikodemus Siivola <email address hidden>
Date: Thu Mar 29 18:31:58 2012 +0300

    MAKE-LEXENV used NCONC on its arguments, which callers did not expect

      Fixes lp#924276.

Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Nikodemus Siivola (nikodemus) wrote :

in SBCL 1.0.57

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