FIND and similar functions throw compile time errors on short improper lists

Bug #1887316 reported by Paul F. Dietz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

These forms might come up in macroexpansion and be dead, so no error should be thrown.

(compile nil '(lambda (c) (let ((x '(1 2 . 3))) (when (proper-list-p x (find c x))))))

==>

The value
  3
is not of type
  LIST
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "new-repl-thread" RUNNING {102BF57813}>)

Backtrace:
  0: (LENGTH (1 2 . 3))
  1: ((SB-C:DEFTRANSFORM FIND) #<SB-C::COMBINATION :FUN #<SB-C::REF :LEAF #<SB-C::GLOBAL-VAR :%SOURCE-NAME FIND :TYPE #1=#<SB-KERNEL:FUN-TYPE #> :DEFINED-TYPE #1# :WHERE-FROM :DECLARED :KIND :GLOBAL-FUNCT..
  2: (SB-C::IR1-OPTIMIZE-COMBINATION #<SB-C::COMBINATION :FUN #<SB-C::REF :LEAF #<SB-C::GLOBAL-VAR :%SOURCE-NAME FIND :TYPE #1=#<SB-KERNEL:FUN-TYPE #> :DEFINED-TYPE #1# :WHERE-FROM :DECLARED :KIND :GLOBAL..
  3: (SB-C::IR1-OPTIMIZE #<SB-C:COMPONENT :NAME (LAMBDA (C)) {102C2D9F63}> NIL)
  4: (SB-C::IR1-OPTIMIZE-UNTIL-DONE #<SB-C:COMPONENT :NAME (LAMBDA (C)) {102C2D9F63}>)
  5: (SB-C::IR1-OPTIMIZE-PHASE-1 #<SB-C:COMPONENT :NAME (LAMBDA (C)) {102C2D9F63}>)
[...]

Similar failures occur with POSITION, POSITION-IF, and likely others.

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

Correction: just position, not position-if.

Stas Boukarev (stassats)
Changed in sbcl:
status: New → 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.