LOOP maximize with type to return bogus values.
Bug #1618518 reported by
Andrzej Walczak
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The LOOP maximize function behaves different if typed with fixnum or integer.
(loop for node in nil maximize 42)
=>
0
(loop for node in nil maximize 42 of-type fixnum)
=>
-46116860184273
.................
("Linux" "3.13.0-88-generic"
"X86-64" "Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz"
"SBCL" "1.3.5.7-890140a")
tags: | added: loop |
To post a comment you must log in.
I think SBCL's behavior is conforming. CLHS 6.1.3 "Value Accumulation Clauses" says
The maximize and minimize constructs compare the value of the supplied form obtained during the first iteration with values obtained in successive iterations. The maximum (for maximize) or minimum (for minimize) value encountered is determined (as if by the function max for maximize and as if by
the function min for minimize) and returned. If the maximize or minimize clause is never executed, the accumulated value is unspecified.