GNU bug report logs - #53451
28.0.91; Different behavior with native-compilation

Previous Next

Package: emacs;

Reported by: Frédéric Giquel <frederic.giquel <at> laposte.net>

Date: Sat, 22 Jan 2022 17:26:01 UTC

Severity: normal

Found in version 28.0.91

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53451 in the body.
You can then email your comments to 53451 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Sat, 22 Jan 2022 17:26:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frédéric Giquel <frederic.giquel <at> laposte.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 Jan 2022 17:26:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frédéric Giquel <frederic.giquel <at> laposte.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.91; Different behavior with native-compilation
Date: Sat, 22 Jan 2022 18:20:38 +0100
Hi all,

I noticed a weird indentation using fish-mode (from MELPA). I tried to
understand the root cause and found that the problem only appears when
using native-compilation.
So I open a bug here (and not in the fish-mode repository).


Here is the procedure to repoduce :

With the following init.el :
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))
(unless (package-installed-p 'fish-mode)
  (package-install 'fish-mode))

Open the "foobar.fish" file with the following content (no indentation
at this step) :
function foobar
if test -n "$argv[1]"
echo foobar
end
end

Indent the whole buffer with :
- M-x mark-whole-buffer
- M-x indent-region


Here is the result I see :

With Emacs 28.0.91 without native-compilation (or with Emacs 27), the
buffer is indented correctly :
function foobar
    if test -n "$argv[1]"
	echo foobar
    end
end

With Emacs 28.0.91 with native-compilation (after ensuring that the
compilation has been done [*]), the indentation is not the same (and
not correct) :
function foobar
    if test -n "$argv[1]"
	echo foobar
end
end

[*] There is 2 warnings about "docstring wider than 80 characters"
during the native compilation of fish-mode


Best regards,
Frédéric Giquel

In GNU Emacs 28.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.31, cairo version 1.16.0)
 of 2022-01-22 built on guiriden
Repository revision: e58ecd01d51471e7e63d20ee059a5c26251220b7
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version
11.0.12014000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix=/opt/emacs28-native --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: 
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fish

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-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
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail mule-util vc-git diff-mode
easy-mmode vc-dispatcher fish-mode cus-edit pp cus-start cus-load
wid-edit compile comint ansi-color ring find-func autoload radix-tree
lisp-mnt mm-archive message dired dired-loaddefs rfc822 mml mml-sec epa
derived gnus-util rmail rmail-loaddefs text-property-search time-date
mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-
utils
gnutls network-stream url-http mail-parse rfc2231 rfc2047 rfc2045
mm-util ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth
epg
rfc6068 epg-config finder-inf package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source eieio eieio-core
eieio-loaddefs password-cache json map url-vars comp comp-cstr warnings
subr-x rx cl-seq cl-macs cl-extra help-mode seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer 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 emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 320362 12926)
 (symbols 48 17171 1)
 (strings 32 94792 3943)
 (string-bytes 1 2484930)
 (vectors 16 30341)
 (vector-slots 8 526241 44385)
 (floats 8 62 308)
 (intervals 56 511 0)
 (buffers 992 17))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Mon, 24 Jan 2022 09:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 53451 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: 53451 <at> debbugs.gnu.org
Cc: Frédéric Giquel <frederic.giquel <at> laposte.net>
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Mon, 24 Jan 2022 09:31:37 +0000
Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Hi all,
>
> I noticed a weird indentation using fish-mode (from MELPA). I tried to
> understand the root cause and found that the problem only appears when
> using native-compilation.
> So I open a bug here (and not in the fish-mode repository).

Hi Frédéric,

the first time fish-mode is used a trace of its native compilation
should appear in the *Async-native-compile-log* buffer.  Could you have
a look and report what is produced there?

PS you can remove the fish-mode .eln already produced somewhere under
~/.emacs.d/eln-cache and restart emacs to re-trigger native compilation
if necessary.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Mon, 24 Jan 2022 19:06:01 GMT) Full text and rfc822 format available.

Message #11 received at 53451 <at> debbugs.gnu.org (full text, mbox):

From: Frédéric Giquel <frederic.giquel <at> laposte.net>
To: Andrea Corallo <akrl <at> sdf.org>, 53451 <at> debbugs.gnu.org
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Mon, 24 Jan 2022 20:04:55 +0100
Le lundi 24 janvier 2022 à 09:31 +0000, Andrea Corallo a écrit :
> Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife
> of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
> 
> > Hi all,
> > 
> > I noticed a weird indentation using fish-mode (from MELPA). I tried
> > to
> > understand the root cause and found that the problem only appears
> > when
> > using native-compilation.
> > So I open a bug here (and not in the fish-mode repository).
> 
> Hi Frédéric,
> 
> the first time fish-mode is used a trace of its native compilation
> should appear in the *Async-native-compile-log* buffer.  Could you
> have
> a look and report what is produced there?

The result of native compilation of fish-mode.el is :
Compiling /home/fred/.emacs.d/elpa/fish-mode-20210215.1114/fish-
mode.el...

In fish/count-tokens-on-current-line:
fish-mode.el:393:8: Warning: docstring wider than 80 characters

In fish/auto-indent-post-indent-check:
fish-mode.el:663:8: Warning: docstring wider than 80 characters
Compilation finished.

If I remove the corresponding docstrings in fish-mode.el, the warnings
disappears in *Async-native-compile-log* but the indentation remains
incorrect.

PS: in my first message, I compared 2 versions of Emacs 28.0.91
(compiled with or without native compilation enabled). We can also
hightlight the problem only using Emacs with native compilation enabled
: if we add "(setq load-no-native t)" in init.el, the indentation is
correct.

Best regards,
Frédéric Giquel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Tue, 08 Feb 2022 21:23:01 GMT) Full text and rfc822 format available.

Message #14 received at 53451 <at> debbugs.gnu.org (full text, mbox):

From: Frédéric Giquel <frederic.giquel <at> laposte.net>
To: Andrea Corallo <akrl <at> sdf.org>, 53451 <at> debbugs.gnu.org
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Tue, 08 Feb 2022 22:22:49 +0100
Hi Andrea,

How can I help ?
Do you need further information ?

Best Regards,
Frédéric Giquel

Le lundi 24 janvier 2022 à 20:04 +0100, Frédéric Giquel a écrit :
> Le lundi 24 janvier 2022 à 09:31 +0000, Andrea Corallo a écrit :
> > Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army
> > knife
> > of
> > text editors" <bug-gnu-emacs <at> gnu.org> writes:
> > 
> > > Hi all,
> > > 
> > > I noticed a weird indentation using fish-mode (from MELPA). I
> > > tried
> > > to
> > > understand the root cause and found that the problem only appears
> > > when
> > > using native-compilation.
> > > So I open a bug here (and not in the fish-mode repository).
> > 
> > Hi Frédéric,
> > 
> > the first time fish-mode is used a trace of its native compilation
> > should appear in the *Async-native-compile-log* buffer.  Could you
> > have
> > a look and report what is produced there?
> 
> The result of native compilation of fish-mode.el is :
> Compiling /home/fred/.emacs.d/elpa/fish-mode-20210215.1114/fish-
> mode.el...
> 
> In fish/count-tokens-on-current-line:
> fish-mode.el:393:8: Warning: docstring wider than 80 characters
> 
> In fish/auto-indent-post-indent-check:
> fish-mode.el:663:8: Warning: docstring wider than 80 characters
> Compilation finished.
> 
> If I remove the corresponding docstrings in fish-mode.el, the
> warnings
> disappears in *Async-native-compile-log* but the indentation remains
> incorrect.
> 
> PS: in my first message, I compared 2 versions of Emacs 28.0.91
> (compiled with or without native compilation enabled). We can also
> hightlight the problem only using Emacs with native compilation
> enabled
> : if we add "(setq load-no-native t)" in init.el, the indentation is
> correct.
> 
> Best regards,
> Frédéric Giquel





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Wed, 09 Feb 2022 09:52:02 GMT) Full text and rfc822 format available.

Message #17 received at 53451 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: 53451 <at> debbugs.gnu.org
Cc: Frédéric Giquel <frederic.giquel <at> laposte.net>
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Wed, 09 Feb 2022 09:51:40 +0000
Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Hi Andrea,
>
> How can I help ?
> Do you need further information ?
>
> Best Regards,
> Frédéric Giquel

Hi Frédéric,

I've isolated `fish-get-end-indent' as the function causing the
different behaviour.  I'll have a look into what is going on and report.

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Wed, 09 Feb 2022 17:17:02 GMT) Full text and rfc822 format available.

Message #20 received at 53451 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: 53451 <at> debbugs.gnu.org
Cc: Frédéric Giquel <frederic.giquel <at> laposte.net>
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Wed, 09 Feb 2022 17:16:53 +0000
Andrea Corallo <akrl <at> sdf.org> writes:

> Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>> Hi Andrea,
>>
>> How can I help ?
>> Do you need further information ?
>>
>> Best Regards,
>> Frédéric Giquel
>
> Hi Frédéric,
>
> I've isolated `fish-get-end-indent' as the function causing the
> different behaviour.  I'll have a look into what is going on and report.
>
> Thanks
>
>   Andrea

Okay, this is an optimizer bug.

The compiler was convinced the following lambda returned 1 :/ and could
optimize accordingly...

(λ (x)
  (if (eq x 0)
      (error "foo")
    (1+ x)))

I've pushed the fix into emacs-28 as 69e82968d7 as I think this is
important to have in the release branch.  The commit include a testcase
as well.

Frédéric if you could compile emacs-28 and verify it works for you would
be nice (I guess you'll have to clean-up at least the miss-compiled
.eln)

Thanks

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53451; Package emacs. (Wed, 09 Feb 2022 20:36:02 GMT) Full text and rfc822 format available.

Message #23 received at 53451 <at> debbugs.gnu.org (full text, mbox):

From: Frédéric Giquel <frederic.giquel <at> laposte.net>
To: Andrea Corallo <akrl <at> sdf.org>, 53451 <at> debbugs.gnu.org
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Wed, 09 Feb 2022 21:35:40 +0100
Le mercredi 09 février 2022 à 17:16 +0000, Andrea Corallo a écrit :
> I've pushed the fix into emacs-28 as 69e82968d7 as I think this is
> important to have in the release branch.  The commit include a
> testcase
> as well.
> 
> Frédéric if you could compile emacs-28 and verify it works for you
> would
> be nice (I guess you'll have to clean-up at least the miss-compiled
> .eln)

I confirm that the indentation issue is resolved.

Thanks for the fix and more generally for your great work on native
compilation.

Frédéric Giquel




Reply sent to Andrea Corallo <akrl <at> sdf.org>:
You have taken responsibility. (Wed, 09 Feb 2022 21:06:02 GMT) Full text and rfc822 format available.

Notification sent to Frédéric Giquel <frederic.giquel <at> laposte.net>:
bug acknowledged by developer. (Wed, 09 Feb 2022 21:06:02 GMT) Full text and rfc822 format available.

Message #28 received at 53451-done <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Frédéric Giquel <frederic.giquel <at> laposte.net>
Cc: 53451-done <at> debbugs.gnu.org
Subject: Re: bug#53451: 28.0.91; Different behavior with native-compilation
Date: Wed, 09 Feb 2022 21:05:46 +0000
Frédéric Giquel <frederic.giquel <at> laposte.net> writes:

> Le mercredi 09 février 2022 à 17:16 +0000, Andrea Corallo a écrit :
>> I've pushed the fix into emacs-28 as 69e82968d7 as I think this is
>> important to have in the release branch.  The commit include a
>> testcase
>> as well.
>> 
>> Frédéric if you could compile emacs-28 and verify it works for you
>> would
>> be nice (I guess you'll have to clean-up at least the miss-compiled
>> .eln)
>
> I confirm that the indentation issue is resolved.
>
> Thanks for the fix and more generally for your great work on native
> compilation.
>
> Frédéric Giquel

Very nice, thank you very much for testing and the kind words.

Closing

  Andrea




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Mar 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.