Subject: bug#24592: closed (Re: bug#22288: 25.0.50; Incorrect line and column number in byte-compilation warning)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 22 Jan 2022 18:18:03 +0000

Your bug report

#22288: 25.1; byte-compile warning indicates wrong line

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
22288: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22288
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#22288: 25.0.50; Incorrect line and column number in byte-compilation warning
From: Alan Mackenzie <[email-masked]>
To: Clément Pit--Claudel <[email-masked]>
Cc: [email-masked]
Date: Sat, 22 Jan 2022 18:16:58 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello Everybody.

This bug has just been fixed in master by merging in branch
scratch/correct-warning-pos.

-- 
Alan Mackenzie (Nuremberg, Germany).

On Fri, Jan 01, 2016 at 10:54:24 -0500, Clément Pit--Claudel wrote:
> Hi all,

> The byte-compiler doesn't always report the right line and column numbers. For example for the following program in test.el:

> (defun test ()
>   (let (a))
>   a)

> Running M-x byte-compile-file RET test.el RET yields:

> > Compiling file /home/clement/test.el at Fri Jan  1 10:48:41 2016

> > In test:
> > test.el:2:9:Warning: reference to free variable ‘a’

> The correct warning would be

> > test.el:3:2:Warning: reference to free variable ‘a’

> Note that the following program gives the right error:

> (defun test ()
>   (let (b))
>   a)

> > test.el:3:3:Warning: reference to free variable ‘a’

> Although one might argue that it should be

> > test.el:3:2:Warning: reference to free variable ‘a’

> (that is, column 2, not 3) given that Emacs starts counting columns at 0.

> Cheers,
> Clément.

> In GNU Emacs 25.0.50.8 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
>  of 2015-12-29 built on clem-w50-mint
> Repository revision: a21bb238ce7bcc9c13a9cf66db77918304daa2fc
> Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
> System Description:	Linux Mint 17.2 Rafaela

Subject: 25.1; byte-compile warning indicates wrong line
From: [email-masked]
To: [email-masked]
Date: Mon, 03 Oct 2016 10:18:25 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Let the contents of the file "tmp.el" be:
(defun test (files)
  (and t (string-match 1))
  (and t (string-match 1 2)))

Then input M-x byte-compile-file RET tmp.el RET

*Compile-Log* buffer shows:
In test:
tmp.el:3:11:Warning: string-match called with 1 argument, but requires 2-3

The warning must indicate the line 2.

In GNU Emacs 25.1.1 (i686-w64-mingw32)
 of 2016-09-18 built on LAPHROAIG
Windowing system distributor 'Microsoft Corp.', version 6.0.6002
Configured using:
 'configure --host=i686-w64-mingw32 --without-dbus
 --without-compress-install CFLAGS=-static'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: JPN
  locale-coding-system: cp932

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  global-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
  line-number-mode: t
  transient-mark-mode: t

Recent messages:

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils advice
warnings byte-opt compile comint ansi-color ring bytecomp byte-compile
cl-extra help-mode easymenu cl-loaddefs pcase cl-lib cconv time-date
mule-util japan-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core 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 charscript case-table epa-hook jka-cmpr-hook help
simple abbrev 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
w32notify w32 multi-tty make-network-process emacs)

Memory information:
((conses 8 103501 6163)
 (symbols 32 20830 0)
 (miscs 32 72 238)
 (strings 16 19286 4465)
 (string-bytes 1 554956)
 (vectors 8 14798)
 (vector-slots 4 535204 5216)
 (floats 8 173 246)
 (intervals 28 315 13)
 (buffers 520 22))