(deftransform search ...) produces unexpected code-deletion-note

Bug #1071310 reported by nixie on 2012-10-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

When compile-file the code below, compiler notifies an unexpected code-deletion-note on #'sb-c::oops from (deftransform search ...).

;; search-foo.lisp
(in-package :cl-user)
(defun search-foo (s)
  (declare (optimize (speed 3) (safety 0))
    (type simple-string s))
  (search "foo" s))

The policy (optimize (speed 3) (safety)) inhibits bounds checking in (deftransform search ...) that causes #'sb-c::oops becoming unused code.

onixie@onixie-laptop:~$ sbcl
This is SBCL 1.1.0.46-3a34044, 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.
* (compile-file "search-foo.lisp")

; compiling file "/home/onixie/search-foo.lisp" (written 25 OCT 2012 08:46:16 PM):
; compiling (IN-PACKAGE :CL-USER)
; compiling (DEFUN SEARCH-FOO ...)
; file: /home/onixie/search-foo.lisp
; in: DEFUN SEARCH-FOO
; (SEARCH "foo" S)
; --> BLOCK
; ==>
; (FLET ((SB-C::OOPS (VECTOR SB-C::START SB-C::END)
; (SB-INT:SEQUENCE-BOUNDING-INDICES-BAD-ERROR VECTOR SB-C::START
; SB-C::END)))
; (LET* ((SB-C::LEN1 (LENGTH SB-C::PATTERN))
; (SB-C::LEN2 (LENGTH SB-C::TEXT))
; (SB-C::END1 (OR SB-C::END1 SB-C::LEN1))
; (SB-C::END2 (OR SB-C::END2 SB-C::LEN2)))
; (DECLARE
; (TYPE SB-INT:INDEX SB-C::START1 SB-C::START2 SB-C::END1 SB-C::END2))
; (WHEN (= SB-C::END1 SB-C::START1)
; (RETURN-FROM SEARCH
; (IF SB-C::FROM-END
; SB-C::END2
; SB-C::START2)))
; (DO ((SB-C::INDEX2 SB-C::START2 #))
; ((>= SB-C::INDEX2 SB-C::END2) NIL)
; (DECLARE (TYPE FIXNUM SB-C::INDEX2))
; (WHEN (DO # # # # #) (RETURN SB-C::INDEX2)))))
;
; note: deleting unused function
; (FLET SB-C::OOPS :IN SEARCH)
;
; compilation unit finished
; printed 1 note

; /home/onixie/search-foo.fasl written
; compilation finished in 0:00:00.026
#P"/home/onixie/search-foo.fasl"
NIL
NIL

onixie@onixie-laptop:~/workdir/sbcl$ uname -a
Linux onixie-laptop 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

SBCL@CL-USER> *features*
(:SWANK :QUICKLISP :SB-BSD-SOCKETS-ADDRINFO :ASDF2 :ASDF :ASDF-UNICODE :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-BLKSIZE-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)

Stas Boukarev (stassats) wrote :

In 010c3b27431e8ec1eb4291d828a74bc434e0e90c.

Changed in sbcl:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers