Loop destructuring default values and declarations

Bug #1189119 reported by Stas Boukarev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Low
Unassigned

Bug Description

By Eric Marsden on sbcl-devel@
CLtS 6.1.2.2 says that "If the optional type-spec argument is supplied
for the variable var, but there is no related expression to be
evaluated, var is initialized to an appropriate default value for its
type. For example, for the types t, number, and float, the default
values are nil, 0, and 0.0 respectively.".

It seems to me that in the example below (from the spec BTW, even if
examples are not normative), the compiler is raising a spurious error
concerning a LOOP-IGNORE-XX variable.

* (lisp-implementation-version)
"1.1.8.49-ded09c0-dirty"
* (loop with (a b c) of-type float return (format nil "~A ~A ~A" a b c))
; in: LOOP WITH
; (LET ((A 0.0) (B 0.0) (C 0.0) (#:LOOP-IGNORE-609 NIL))
; (DECLARE (TYPE FLOAT #:LOOP-IGNORE-609)
; (IGNORE #:LOOP-IGNORE-609)
; (TYPE FLOAT C)
; (TYPE FLOAT B)
; (TYPE FLOAT A))
; (SB-LOOP::LOOP-BODY NIL NIL
; ((RETURN-FROM NIL (FORMAT NIL "~A ~A ~A" A B C))) NIL
; NIL))
;
; caught WARNING:
; Constant NIL conflicts with its asserted type FLOAT.

(From sacla-tests)

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

Got fixed in a5ac94abb11975f334d3eb18f6f339b9e7dc5a5d.

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