unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53451: 28.0.91; Different behavior with native-compilation
@ 2022-01-22 17:20 Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-24  9:31 ` Andrea Corallo
  0 siblings, 1 reply; 8+ messages in thread
From: Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-22 17:20 UTC (permalink / raw)
  To: 53451

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))






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-01-22 17:20 bug#53451: 28.0.91; Different behavior with native-compilation Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-24  9:31 ` Andrea Corallo
  2022-01-24 19:04   ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea Corallo @ 2022-01-24  9:31 UTC (permalink / raw)
  To: 53451; +Cc: Frédéric Giquel

Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-01-24  9:31 ` Andrea Corallo
@ 2022-01-24 19:04   ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-08 21:22     ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-24 19:04 UTC (permalink / raw)
  To: Andrea Corallo, 53451

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@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-01-24 19:04   ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-08 21:22     ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-09  9:51       ` Andrea Corallo
  0 siblings, 1 reply; 8+ messages in thread
From: Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-08 21:22 UTC (permalink / raw)
  To: Andrea Corallo, 53451

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@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






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-02-08 21:22     ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-09  9:51       ` Andrea Corallo
  2022-02-09 17:16         ` Andrea Corallo
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea Corallo @ 2022-02-09  9:51 UTC (permalink / raw)
  To: 53451; +Cc: Frédéric Giquel

Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-02-09  9:51       ` Andrea Corallo
@ 2022-02-09 17:16         ` Andrea Corallo
  2022-02-09 20:35           ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 8+ messages in thread
From: Andrea Corallo @ 2022-02-09 17:16 UTC (permalink / raw)
  To: 53451; +Cc: Frédéric Giquel

Andrea Corallo <akrl@sdf.org> writes:

> Frédéric Giquel via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-02-09 17:16         ` Andrea Corallo
@ 2022-02-09 20:35           ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-09 21:05             ` Andrea Corallo
  0 siblings, 1 reply; 8+ messages in thread
From: Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-09 20:35 UTC (permalink / raw)
  To: Andrea Corallo, 53451

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#53451: 28.0.91; Different behavior with native-compilation
  2022-02-09 20:35           ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-09 21:05             ` Andrea Corallo
  0 siblings, 0 replies; 8+ messages in thread
From: Andrea Corallo @ 2022-02-09 21:05 UTC (permalink / raw)
  To: Frédéric Giquel; +Cc: 53451-done

Frédéric Giquel <frederic.giquel@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-09 21:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 17:20 bug#53451: 28.0.91; Different behavior with native-compilation Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-24  9:31 ` Andrea Corallo
2022-01-24 19:04   ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-08 21:22     ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-09  9:51       ` Andrea Corallo
2022-02-09 17:16         ` Andrea Corallo
2022-02-09 20:35           ` Frédéric Giquel via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-09 21:05             ` Andrea Corallo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).