DOTIMES does not check that count-form yields an integer

Bug #619393 reported by Roman Marynchak on 2010-08-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

This code

(dotimes (x 7.7) (print x))

should fail to execute in REPL, because 7.7 is not of type INTEGER. CLHS is clear about it: "dotimes evaluates count-form, which should produce an integer", but SBCL and CLISP have the bug - they seem to use NUMBERP, and x gets printed.

The simple fix - use strict INTEGERP instead of NUMBERP.

The test is coming soon.

Changed in sbcl:
assignee: nobody → Roman Marynchak (roman-marynchak)

The simple test case. I am not sure about the exact test file, so please copy it to the appropriate one when merging the fix into CVS. Note that 'success' tests are not required, because DOTIMES is used in many system files and other tests as well.

;;; DOTIMES should accept the integer count-form value only. Bug #619393 in Launchpad.

(with-test (:name :dotimes-non-integer-counter-value)
  (assert (raises-error? (dotimes (i 8.6) nil))))

tags: added: review
Changed in sbcl:
status: New → Confirmed
importance: Undecided → Low
Changed in sbcl:
assignee: Roman Marynchak (roman-marynchak) → Nikodemus Siivola (nikodemus)
Nikodemus Siivola (nikodemus) wrote :


Changed in sbcl:
status: Confirmed → Fix Committed
tags: removed: review
Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
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