Subject: 24.3; Incorrect unused variable byte-compiler warning in dotimes
From: Christopher Wellons <[email-masked]>
To: [email-masked]
Date: Fri, 20 Dec 2013 16:06:38 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

When `lexical-binding' is t the byte-compiler issues an invalid warning
for `dotimes' when the optional "result" form is used. For example,
byte-compile a file with these contents.

    ;;; -*- lexical-binding: t; -*-
    (defun foo ()
      (dotimes (i 1 t) i))

Or evaluate this form.

    (let ((lexical-binding t))
      (byte-compile (lambda () (dotimes (i 1 t) i))))

Output:

    Warning: Unused lexical variable `i'

If the t is removed the warning goes away.