Subject: 26.3; Incorrect byte-compiler warning

From: Mike Woolley <[email-masked]>
Date: Wed, 4 Mar 2020 23:18:07 +0000

Compiling this minimal test:

;; -*- lexical-binding: t -*-

(dotimes (i 10 t)
    (prin1 i))

Gives the incorrect warning: "Unused lexical variable ‘i’”, even though `i' is clearly used inside the loop.

However the following version (dropping the [result] form from `dotimes') does not give the warning:

(dotimes (i 10)
    (prin1 i))

This would seem like a bug to me.
Please advise?

Thanks,
Mike

In GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-09-02 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1894
Recent messages:
Undo!
next-line: End of buffer [2 times]
Mark set [2 times]
auto trimmed 0 chars
Saving file /Users/mike/tmp/test.el...
Wrote /Users/mike/tmp/test.el
Mark saved where search started
Saving file /Users/mike/tmp/test.el...
Wrote /Users/mike/tmp/test.el
Type "q" to restore previous buffer. [3 times]
previous-line: Beginning of buffer [2 times]
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  global-git-gutter-mode: t
  git-gutter-mode: t
  global-company-mode: t
  company-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  helm-mode: t
  async-bytecomp-package-mode: t
  clean-aindent-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-auto-revert-mode: t
  global-semantic-decoration-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-highlight-func-mode: t
  global-semantic-stickyfunc-mode: t
  semantic-mode: t
  helm-autoresize-mode: t
  which-function-mode: t
  show-paren-mode: t
  recentf-mode: t
  msb-mode: t
  gud-tooltip-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort face-remap flyspell ispell mail-extr gnus-msg gnus-art
mm-uu mml2015 mm-view mml-smime smime dig gnus-sum gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls utf7 netrc
nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader emacsbug
message rmc puny rfc822 mml mml-sec epa derived epg gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils helm-command eieio-opt speedbar sb-image
dframe help-fns radix-tree windmove misearch multi-isearch ido
wildcard-to-regexp dired-explore dired-sort-menu ls-lisp dired-x dired
dired-loaddefs helm-x-files bs helm-for-files helm-bookmark
helm-adaptive bookmark pp add-log winner image-file helm-external
helm-net browse-url xml url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap tramp tramp-compat
tramp-loaddefs trampver shell pcomplete parse-time ffap server
gnuemacs-config my-commands rg rg-ibuffer rg-result wgrep-rg wgrep s
rg-history rg-header rg-compat ibuf-ext ibuffer ibuffer-loaddefs grep
helm-ls-git vc-git diff-mode vc vc-dispatcher git-gutter-fringe
git-gutter helm-company helm-elisp helm-eval edebug helm-info
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-bbdb company pcase flycheck json map rx dash
helm-mode helm-config helm-easymenu async-bytecomp xahk-mode thingatpt
htmlize clean-aindent-mode yasnippet-snippets yasnippet elec-pair
gc-info autorevert filenotify semantic/decorate/mode semantic/decorate
semantic/db-mode semantic/db eieio-base semantic/idle semantic/format
ezimage semantic/tag-ls semantic/find semantic/ctxt semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
find-func cedet tempo filladapt helm-gtags subr-x pulse helm-files
helm-buffers helm-tags helm-locate helm-grep helm-regexp format-spec
helm-utils helm-help helm-types helm edmacro kmacro helm-source
eieio-compat helm-multi-match helm-lib advice async ggtags etags xref
project compile ewoc use-package-diminish my-generic generic generic-x
jka-compr which-func imenu paren recentf tree-widget wid-edit msb gud
easy-mmode comint ansi-color ring time cus-start cus-load redo+ b
b-window b-undo b-movement b-editing b-marking b-bookmark fringe-helper
b-compat diminish poet-theme use-package-ensure use-package-core
finder-inf info package epg-config url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars
seq byte-opt bytecomp byte-compile cconv cl-extra help-mode easymenu
my-compat cl gv cl-loaddefs cl-lib time-date tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 676901 15049)
 (symbols 48 49397 24)
 (miscs 40 261 1018)
 (strings 32 171654 3031)
 (string-bytes 1 4841259)
 (vectors 16 78649)
 (vector-slots 8 1272975 58328)
 (floats 8 323 248)
 (intervals 56 1704 225)
 (buffers 992 24))