* bug#47191: 28.0.50; Native compilation branch freeze in cc-mode
@ 2021-03-16 15:24 Damien
2021-03-16 16:35 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-17 7:48 ` bug#47191: File as attachment Damien
0 siblings, 2 replies; 11+ messages in thread
From: Damien @ 2021-03-16 15:24 UTC (permalink / raw)
To: 47191
Using the native compilation branch, Create tmp.cpp with this:
```
// In state_machine
private: auto
state_machine::stop_bbbbbbb(states::recording &&s,
aaaaaa::bbbbbbb_stopped_reason reason)
-> fsm::state_machine<
aaaaaa::bbbbbbb::state_machine,
std::variant<aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_connected,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_disconnected,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_state,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_info,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_battery,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_error,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_valid>,
std::variant<aaaaa::bbbb::aaaaaa::bbbbbbb::states::init>>::state
```
Open using `emacs -Q tmp.cpp` and emacs freezes.
I managed to get some backtrace using `kill -USR2`:
* #f(compiled-function () #<bytecode 0xb89cd227791443a>)()
font-lock-default-fontify-region(35 597 nil)
c-font-lock-fontify-region(48 548 nil)
font-lock-fontify-region(48 548)
#f(compiled-function (fun) #<bytecode 0x1f23231d0aa2fbbe>)(font-lock-fontify-region)
run-hook-wrapped(#f(compiled-function (fun) #<bytecode 0x1f23231d0aa2fbbe>) font-lock-fontify-region)
jit-lock--run-functions(48 548)
jit-lock-fontify-now(48 548)
jit-lock-function(48)
redisplay_internal\ \(C\ function\)()
but at that point emacs is nearly unusable.
In GNU Emacs 28.0.50 (build 8, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
of 2021-03-16 built on workstation.lan
Repository revision: f3abb1711811f43d1504d8e48f0d27e015b46d6c
Repository branch: feature/native-comp
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Ubuntu 20.10
Configured using:
'configure --with-nativecomp --with-mailutils --with-pgtk --with-gnutls
--with-modules --with-json --without-gpm --with-file-notification=yes
--with-xwidgets --without-selinux --with-libsystemd CC=gcc-10'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB
Important settings:
value of $LC_MONETARY: fr_BE.UTF-8
value of $LC_NUMERIC: fr_BE.UTF-8
value of $LC_TIME: fr_BE.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Magit
Minor modes in effect:
bloom-global-minor-mode: t
global-company-mode: t
company-mode: t
magit-wip-after-apply-mode: t
global-git-commit-mode: t
magit-auto-revert-mode: t
pdf-occur-global-minor-mode: t
yas-global-mode: t
yas-minor-mode: t
smartparens-global-mode: t
show-paren-mode: t
marginalia-mode: t
selectrum-prescient-mode: t
prescient-persist-mode: t
global-ligature-mode: t
ligature-mode: t
shell-dirtrack-mode: t
envrc-global-mode: t
envrc-mode: t
bepo-global-mode: t
which-key-mode: t
savehist-mode: t
Info-breadcrumbs-in-mode-line-mode: t
override-global-mode: t
selectrum-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-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
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
~/.emacs.d/pkg/bloomlife/aio-let hides ~/.emacs.d/pkg/jiracs/aio-let
~/.emacs.d/pkg/dash-docs/dash-docs hides /home/dam/.emacs.d/var/elpa/dash-docs-20200516.1943/dash-docs
~/.emacs.d/pkg/use-package/use-package-ensure-system-package hides /home/dam/.emacs.d/var/elpa/use-package-ensure-system-package-20180913.1501/use-package-ensure-system-package
~/.emacs.d/pkg/use-package/use-package-ensure hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-ensure
~/.emacs.d/pkg/use-package/use-package hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package
~/.emacs.d/pkg/use-package/use-package-bind-key hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-bind-key
~/.emacs.d/pkg/use-package/use-package-lint hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-lint
~/.emacs.d/pkg/use-package/use-package-diminish hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-diminish
~/.emacs.d/pkg/use-package/use-package-delight hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-delight
~/.emacs.d/pkg/use-package/use-package-jump hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-jump
~/.emacs.d/pkg/use-package/use-package-core hides /home/dam/.emacs.d/var/elpa/use-package-20210207.1926/use-package-core
~/.emacs.d/pkg/use-package/bind-key hides /home/dam/.emacs.d/var/elpa/bind-key-20210210.1609/bind-key
Features:
(shadow sort mail-extr emacsbug sendmail mule-util face-remap vc-mtn
vc-hg vc-bzr vc-src vc-sccs vc-cvs vc-rcs vc checkdoc lisp-mnt form-feed
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb bloomlife bloom-mode eglot array jsonrpc ert ewoc debug
backtrace sonar circleci bitbucket bloom-sensor gdb-mi bloom-tools
bloom-org bloom-magit bloom-project bloom-test-runner bloom-common
bloom-build bloom-cmake bloom-conan bloom-bbw bloom-target bloom-pkg
atlassian atlassian-jira atlassian-common request jiracs json-bind
aio-let jiracs-mode jiracs-db jiracs-common aio company-terraform
company-terraform-data terraform-mode hcl-mode company racer
smartparens-rust rust-mode rubocop robe etags fileloop generator
inf-ruby rbenv ruby-mode smie smartparens-python python tramp-sh
smartparens-scala scala-mode scala-mode-prettify-symbols
scala-mode-imenu scala-mode-map scala-mode-fontlock scala-mode-indent
scala-mode-paragraph scala-mode-syntax scala-mode-lib java-imports
pcache eieio-base elisp-format flyspell test-runner-ert elfmt cask-mode
djinni-mode gud-lldb cmake-api test-runner-catch2 eldoc-cmake cmake-mode
smartparens-rst rst android pbuf gud xref forge-list forge-commands
forge-semi forge-bitbucket buck forge-gogs gogs forge-gitea gtea
forge-gitlab glab forge-github forge-notify forge-revnote forge-pullreq
forge-issue forge-topic bug-reference forge-post forge-repo forge
forge-core forge-db closql emacsql-sqlite emacsql emacsql-compiler
ghub-graphql treepy gsexp ghub url-http url-gw nsm url-auth magit-extras
magit-bookmark magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func magit-diff smerge-mode git-commit log-edit message rmc rfc822
mml mml-sec epa epg epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert magit-margin magit-transient magit-process with-editor
server magit-mode magit-git magit-section magit-utils git-timemachine
transient vc-git diff-mode vc-dispatcher flymake-cursor flymake-proc
flymake warnings diff ispell reformatter test-runner ag vc-svn
find-dired dired-collapse dired-rainbow dired-narrow delsel dired-filter
f s dired-hacks-utils dired-x dired-aux plantuml-mode pdf-occur ibuf-ext
ibuffer ibuffer-loaddefs tablist tablist-filter semantic/wisent/comp
semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util
semantic semantic/tag semantic/lex semantic/fw mode-local find-func
cedet pdf-isearch let-alist pdf-misc imenu pdf-tools pdf-view jka-compr
pdf-cache pdf-info tq pdf-util xwwp eww xdg url-queue shr kinsoku svg
dom mm-url gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045
ietf-drums mail-utils mm-util mail-prsvr xwidget image-mode dired
dired-loaddefs exif bookmark smartparens-markdown markdown-mode noutline
outline yasnippet wgrep grep compile text-property-search cap-words
superword subword string-inflection smartparens-config smartparens-text
smartparens-c smartparens-ruby smartparens dash cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
paren mmm-mode mmm-univ mmm-class mmm-region mmm-auto mmm-vars mmm-utils
mmm-compat iedit iedit-lib autorevert filenotify marginalia project
selectrum-prescient selectrum minibuf-eldef crm prescient all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons ligature
solarized-dark-high-contrast-theme solarized-palettes solarized-theme
solarized solarized-faces color use-theme pcase tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete comint
ring parse-time iso8601 time-date ls-lisp envrc inheritenv ansi-color
eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module
esh-groups esh-util bepo which-key time savehist recentf tree-widget
advice info+ exec-path-from-shell diminish dash-docs
use-package-dash-docs gnutls puny thingatpt format-spec xml async
no-littering use-package-ensure-system-package system-packages cl-extra
help-mode use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key use-package-core
derived edmacro kmacro easy-mmode cl rx info cus-edit pp cus-start
cus-load wid-edit 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 cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
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 elisp-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
facemenu 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 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
xwidget-internal dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)
Memory information:
((conses 16 705250 558960)
(symbols 48 45820 1)
(strings 32 175645 34938)
(string-bytes 1 6557321)
(vectors 16 76584)
(vector-slots 8 1715804 487208)
(floats 8 1183 1016)
(intervals 56 749 5)
(buffers 992 21))
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: 28.0.50; Native compilation branch freeze in cc-mode
2021-03-16 15:24 bug#47191: 28.0.50; Native compilation branch freeze in cc-mode Damien
@ 2021-03-16 16:35 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-17 7:07 ` Damien
2021-03-17 7:47 ` Damien
2021-03-17 7:48 ` bug#47191: File as attachment Damien
1 sibling, 2 replies; 11+ messages in thread
From: Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-16 16:35 UTC (permalink / raw)
To: Damien; +Cc: 47191
Damien <dam@cosinux.org> writes:
> Using the native compilation branch, Create tmp.cpp with this:
>
> ```
> // In state_machine
> private: auto
> state_machine::stop_bbbbbbb(states::recording &&s,
> aaaaaa::bbbbbbb_stopped_reason reason)
> -> fsm::state_machine<
> aaaaaa::bbbbbbb::state_machine,
> std::variant<aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_connected,
> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_disconnected,
> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_state,
> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_info,
> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_battery,
> aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_error,
> aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_valid>,
> std::variant<aaaaa::bbbb::aaaaaa::bbbbbbb::states::init>>::state
> ```
>
> Open using `emacs -Q tmp.cpp` and emacs freezes.
I've just compiled f3abb17118 but I can't reproduce this.
I'm seeing you are compiling with '--with-nativecomp', we have changed
the flag into '--with-nativecompilation' (yeah sorry) so native
compilation is disable on your build (should be also listed in
"Configured features:" if enabled).
Rebuilding f3abb17118 without enabling native compilation I still can't
reproduce this :(
Thanks
Andrea
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: 28.0.50; Native compilation branch freeze in cc-mode
2021-03-16 16:35 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-17 7:07 ` Damien
2021-03-17 7:47 ` Damien
1 sibling, 0 replies; 11+ messages in thread
From: Damien @ 2021-03-17 7:07 UTC (permalink / raw)
To: Andrea Corallo; +Cc: 47191
Hello,
Thank you for your response, I'll try again with the same commit and the right configuration flag :)
Damien
"Andrea Corallo" akrl@sdf.org – 16 mars 2021 16:35
> Damien <dam@cosinux.org> writes:
>
> > Using the native compilation branch, Create tmp.cpp with this:
> >
> > ```
> > // In state_machine
> > private: auto
> > state_machine::stop_bbbbbbb(states::recording &&s,
> > aaaaaa::bbbbbbb_stopped_reason reason)
> > -> fsm::state_machine<
> > aaaaaa::bbbbbbb::state_machine,
> > std::variant<aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_connected,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_disconnected,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_state,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_info,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_battery,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_error,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_valid>,
> > std::variant<aaaaa::bbbb::aaaaaa::bbbbbbb::states::init>>::state
> > ```
> >
> > Open using `emacs -Q tmp.cpp` and emacs freezes.
>
> I've just compiled f3abb17118 but I can't reproduce this.
>
> I'm seeing you are compiling with '--with-nativecomp', we have changed
> the flag into '--with-nativecompilation' (yeah sorry) so native
> compilation is disable on your build (should be also listed in
> "Configured features:" if enabled).
>
> Rebuilding f3abb17118 without enabling native compilation I still can't
> reproduce this :(
>
> Thanks
>
> Andrea
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: 28.0.50; Native compilation branch freeze in cc-mode
2021-03-16 16:35 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-17 7:07 ` Damien
@ 2021-03-17 7:47 ` Damien
2021-03-22 17:01 ` Daniel Colascione
1 sibling, 1 reply; 11+ messages in thread
From: Damien @ 2021-03-17 7:47 UTC (permalink / raw)
To: 47191
So I just tested again, with recompiling with `--with-nativecompilation` and I have the exact same behavior. So maybe it is not linked to the compilation branch then. I'll try to reproduce it this weekend on master and maybe bisect it.
"Andrea Corallo" akrl@sdf.org – 16 mars 2021 16:35
> Damien <dam@cosinux.org> writes:
>
> > Using the native compilation branch, Create tmp.cpp with this:
> >
> > ```
> > // In state_machine
> > private: auto
> > state_machine::stop_bbbbbbb(states::recording &&s,
> > aaaaaa::bbbbbbb_stopped_reason reason)
> > -> fsm::state_machine<
> > aaaaaa::bbbbbbb::state_machine,
> > std::variant<aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_connected,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_disconnected,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_state,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_info,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_battery,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_error,
> > aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_valid>,
> > std::variant<aaaaa::bbbb::aaaaaa::bbbbbbb::states::init>>::state
> > ```
> >
> > Open using `emacs -Q tmp.cpp` and emacs freezes.
>
> I've just compiled f3abb17118 but I can't reproduce this.
>
> I'm seeing you are compiling with '--with-nativecomp', we have changed
> the flag into '--with-nativecompilation' (yeah sorry) so native
> compilation is disable on your build (should be also listed in
> "Configured features:" if enabled).
>
> Rebuilding f3abb17118 without enabling native compilation I still can't
> reproduce this :(
>
> Thanks
>
> Andrea
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: File as attachment
2021-03-16 15:24 bug#47191: 28.0.50; Native compilation branch freeze in cc-mode Damien
2021-03-16 16:35 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-17 7:48 ` Damien
2021-03-19 15:28 ` Eli Zaretskii
1 sibling, 1 reply; 11+ messages in thread
From: Damien @ 2021-03-17 7:48 UTC (permalink / raw)
To: 47191
[-- Attachment #1: Type: text/plain, Size: 78 bytes --]
Also here is the file as attachment to make sure it was not a copy/paste error
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tmp.cpp --]
[-- Type: text/x-c++src; name=tmp.cpp, Size: 818 bytes --]
// In state_machine
private: auto
state_machine::stop_bbbbbbb(states::recording &&s,
aaaaaa::bbbbbbb_stopped_reason reason)
-> fsm::state_machine<
aaaaaa::bbbbbbb::state_machine,
std::variant<aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_connected,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_disconnected,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_state,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_info,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_battery,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_error,
aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_valid>,
std::variant<aaaaa::bbbb::aaaaaa::bbbbbbb::states::init>>::state
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: File as attachment
2021-03-17 7:48 ` bug#47191: File as attachment Damien
@ 2021-03-19 15:28 ` Eli Zaretskii
2021-03-19 18:32 ` Alan Mackenzie
2021-03-20 20:30 ` Alan Mackenzie
0 siblings, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2021-03-19 15:28 UTC (permalink / raw)
To: Damien, Alan Mackenzie; +Cc: 47191
> From: Damien <dam@cosinux.org>
> Date: Wed, 17 Mar 2021 07:48:39 +0000
>
> Also here is the file as attachment to make sure it was not a copy/paste error
Thanks.
Emacs infloops in redisplay when visiting this file, because
fontification of this file infloops, and that happens on the master
branch as well, so it has nothing to do with native-compilation
branch. The infloop seems to be in c-forward-name, I attach the
backtrace below.
Alan, could you please look into this?
#0 exec_byte_code (bytestr=XIL(0x8000000006d786e0),
vector=XIL(0xa000000006d4ad80), maxdepth=make_fixnum(9),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#1 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000006d4af30),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#2 0x0125fda5 in funcall_lambda (fun=XIL(0xa000000006d4af30), nargs=0,
arg_vector=0x8234a0) at eval.c:3186
#3 0x0125e77c in Ffuncall (nargs=1, args=0x823498) at eval.c:2916
#4 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000006d78790),
vector=XIL(0xa000000006d4b110), maxdepth=make_fixnum(8),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#5 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000006d4b358),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#6 0x0125fda5 in funcall_lambda (fun=XIL(0xa000000006d4b358), nargs=1,
arg_vector=0x823e30) at eval.c:3186
#7 0x0125e77c in Ffuncall (nargs=2, args=0x823e28) at eval.c:2916
#8 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000006379710),
vector=XIL(0xa00000000632b208), maxdepth=make_fixnum(22),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#9 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa00000000632b838),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#10 0x0125fda5 in funcall_lambda (fun=XIL(0xa00000000632b838), nargs=3,
arg_vector=0x825240) at eval.c:3186
#11 0x0125e77c in Ffuncall (nargs=4, args=0x825238) at eval.c:2916
#12 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000006f43090),
vector=XIL(0xa000000006d7e508), maxdepth=make_fixnum(8),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#13 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000006d7e6e0),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#14 0x0125fda5 in funcall_lambda (fun=XIL(0xa000000006d7e6e0), nargs=3,
arg_vector=0x825990) at eval.c:3186
#15 0x0125e77c in Ffuncall (nargs=4, args=0x825988) at eval.c:2916
#16 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000006d6e030),
vector=XIL(0xa000000006f0cc38), maxdepth=make_fixnum(12),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#17 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000006f0aef8),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#18 0x0125fda5 in funcall_lambda (fun=XIL(0xa000000006f0aef8), nargs=4,
arg_vector=0x826d30) at eval.c:3186
#19 0x0125e77c in Ffuncall (nargs=5, args=0x826d28) at eval.c:2916
#20 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000006f43070),
vector=XIL(0xa000000006d7e708), maxdepth=make_fixnum(13),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#21 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000006d7e7e0),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#22 0x0125fda5 in funcall_lambda (fun=XIL(0xa000000006d7e7e0), nargs=1,
arg_vector=0x8273c8) at eval.c:3186
#23 0x0125e77c in Ffuncall (nargs=2, args=0x8273c0) at eval.c:2916
#24 0x012c9c64 in exec_byte_code (bytestr=XIL(0x80000000059b1b9c),
vector=XIL(0xa0000000059b142c), maxdepth=make_fixnum(23),
args_template=make_fixnum(770), nargs=3, args=0x827b58) at bytecode.c:632
#25 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa0000000059b13fc),
syms_left=make_fixnum(770), nargs=3, args=0x827b40) at eval.c:3036
#26 0x0125f7ce in funcall_lambda (fun=XIL(0xa0000000059b13fc), nargs=3,
arg_vector=0x827b40) at eval.c:3117
#27 0x0125e77c in Ffuncall (nargs=4, args=0x827b38) at eval.c:2916
#28 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000005c12a94),
vector=XIL(0xa0000000059b0c6c), maxdepth=make_fixnum(11),
args_template=make_fixnum(771), nargs=3, args=0x8281a8) at bytecode.c:632
#29 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa0000000059b0c3c),
syms_left=make_fixnum(771), nargs=3, args=0x828190) at eval.c:3036
#30 0x0125f7ce in funcall_lambda (fun=XIL(0xa0000000059b0c3c), nargs=3,
arg_vector=0x828190) at eval.c:3117
#31 0x0125e77c in Ffuncall (nargs=4, args=0x828188) at eval.c:2916
#32 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000006f4c010),
vector=XIL(0xa000000006fb3248), maxdepth=make_fixnum(5),
args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
#33 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000000ffaa88),
syms_left=XIL(0), nargs=0, args=0x0) at eval.c:3036
#34 0x0125fda5 in funcall_lambda (fun=XIL(0xa000000000ffaa88), nargs=3,
arg_vector=0x828808) at eval.c:3186
#35 0x0125e77c in Ffuncall (nargs=4, args=0x828800) at eval.c:2916
#36 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000005c12b5c),
vector=XIL(0xa0000000059b0b9c), maxdepth=make_fixnum(7),
args_template=make_fixnum(770), nargs=2, args=0x828dd8) at bytecode.c:632
#37 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa0000000059b0b6c),
syms_left=make_fixnum(770), nargs=2, args=0x828dc8) at eval.c:3036
#38 0x0125f7ce in funcall_lambda (fun=XIL(0xa0000000059b0b6c), nargs=2,
arg_vector=0x828dc8) at eval.c:3117
#39 0x0125e77c in Ffuncall (nargs=3, args=0x828dc0) at eval.c:2916
#40 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000005a0f26c),
vector=XIL(0xa000000006fdbce8), maxdepth=make_fixnum(10),
args_template=make_fixnum(257), nargs=1, args=0x8296a0) at bytecode.c:632
#41 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000006fdbd30),
syms_left=make_fixnum(257), nargs=1, args=0x829698) at eval.c:3036
#42 0x0125f7ce in funcall_lambda (fun=XIL(0xa000000006fdbd30), nargs=1,
arg_vector=0x829698) at eval.c:3117
#43 0x0125e77c in Ffuncall (nargs=2, args=0x829690) at eval.c:2916
#44 0x0125d363 in run_hook_wrapped_funcall (nargs=2, args=0x829690)
at eval.c:2651
#45 0x0125d814 in run_hook_with_args (nargs=2, args=0x829690,
funcall=0x125d31b <run_hook_wrapped_funcall>) at eval.c:2732
#46 0x0125d3b2 in Frun_hook_wrapped (nargs=2, args=0x829690) at eval.c:2666
#47 0x0125ebb4 in funcall_subr (subr=0x1713ce0 <Srun_hook_wrapped>,
numargs=2, args=0x829690) at eval.c:2967
#48 0x0125e722 in Ffuncall (nargs=3, args=0x829688) at eval.c:2914
#49 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000005a0f43c),
vector=XIL(0xa000000005a0f124), maxdepth=make_fixnum(16),
args_template=make_fixnum(514), nargs=2, args=0x829cd0) at bytecode.c:632
#50 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa000000005a0f0f4),
syms_left=make_fixnum(514), nargs=2, args=0x829cc0) at eval.c:3036
#51 0x0125f7ce in funcall_lambda (fun=XIL(0xa000000005a0f0f4), nargs=2,
arg_vector=0x829cc0) at eval.c:3117
#52 0x0125e77c in Ffuncall (nargs=3, args=0x829cb8) at eval.c:2916
#53 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000005c7f634),
vector=XIL(0xa0000000059504d4), maxdepth=make_fixnum(27),
args_template=make_fixnum(512), nargs=2, args=0x82a3f8) at bytecode.c:632
#54 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa0000000059504a4),
syms_left=make_fixnum(512), nargs=2, args=0x82a3e8) at eval.c:3036
#55 0x0125f7ce in funcall_lambda (fun=XIL(0xa0000000059504a4), nargs=2,
arg_vector=0x82a3e8) at eval.c:3117
#56 0x0125e77c in Ffuncall (nargs=3, args=0x82a3e0) at eval.c:2916
#57 0x012c9c64 in exec_byte_code (bytestr=XIL(0x8000000005c7f6c4),
vector=XIL(0xa00000000595019c), maxdepth=make_fixnum(12),
args_template=make_fixnum(257), nargs=1, args=0x82aa70) at bytecode.c:632
#58 0x0125f251 in fetch_and_exec_byte_code (fun=XIL(0xa00000000595016c),
syms_left=make_fixnum(257), nargs=1, args=0x82aa68) at eval.c:3036
#59 0x0125f7ce in funcall_lambda (fun=XIL(0xa00000000595016c), nargs=1,
arg_vector=0x82aa68) at eval.c:3117
#60 0x0125e77c in Ffuncall (nargs=2, args=0x82aa60) at eval.c:2916
#61 0x01258d8b in internal_condition_case_n (bfun=0x125e546 <Ffuncall>,
nargs=2, args=0x82aa60, handlers=XIL(0x30),
hfun=0x10415e2 <safe_eval_handler>) at eval.c:1519
#62 0x01041815 in safe__call (inhibit_quit=false, nargs=2,
func=XIL(0x410debc), ap=0x82ab24 "") at xdisp.c:2981
#63 0x0104188e in safe_call (nargs=2, func=XIL(0x410debc)) at xdisp.c:2996
#64 0x010418e2 in safe_call1 (fn=XIL(0x410debc), arg=make_fixnum(1))
at xdisp.c:3007
#65 0x0104555a in handle_fontified_prop (it=0x82adc8) at xdisp.c:4313
#66 0x01043ee1 in handle_stop (it=0x82adc8) at xdisp.c:3841
#67 0x0104f729 in reseat (it=0x82adc8, pos=..., force_p=true) at xdisp.c:7087
#68 0x0104313f in init_iterator (it=0x82adc8, w=0x6c63828, charpos=1,
bytepos=1, row=0x6d999a0, base_face_id=DEFAULT_FACE_ID) at xdisp.c:3442
#69 0x010431d7 in start_display (it=0x82adc8, w=0x6c63828, pos=...)
at xdisp.c:3458
#70 0x01077b56 in try_window (window=XIL(0xa000000006c63828), pos=...,
flags=1) at xdisp.c:19451
#71 0x01074728 in redisplay_window (window=XIL(0xa000000006c63828),
just_this_one_p=false) at xdisp.c:18867
#72 0x0106c205 in redisplay_window_0 (window=XIL(0xa000000006c63828))
at xdisp.c:16581
#73 0x01258b9b in internal_condition_case_1 (
bfun=0x106c1ad <redisplay_window_0>, arg=XIL(0xa000000006c63828),
handlers=XIL(0xc000000005ca111c), hfun=0x106c16a <redisplay_window_error>)
at eval.c:1463
#74 0x0106c12c in redisplay_windows (window=XIL(0xa000000006c63828))
at xdisp.c:16561
#75 0x0106a97d in redisplay_internal () at xdisp.c:16029
#76 0x010681a8 in redisplay () at xdisp.c:15245
#77 0x01169314 in read_char (commandflag=1, map=XIL(0xc000000006fbe420),
prev_event=XIL(0), used_mouse_menu=0x82f42f, end_time=0x0)
at keyboard.c:2496
#78 0x011810c8 in read_key_sequence (keybuf=0x82f730, prompt=XIL(0),
dont_downcase_last=false, can_return_switch_frame=true,
fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9491
#79 0x01164e96 in command_loop_1 () at keyboard.c:1353
#80 0x01258ab1 in internal_condition_case (bfun=0x1164773 <command_loop_1>,
handlers=XIL(0x90), hfun=0x11639d1 <cmd_error>) at eval.c:1439
#81 0x011641e0 in command_loop_2 (ignore=XIL(0)) at keyboard.c:1094
#82 0x01257b94 in internal_catch (tag=XIL(0xe3d0),
func=0x11641a3 <command_loop_2>, arg=XIL(0)) at eval.c:1189
#83 0x0116415d in command_loop () at keyboard.c:1073
#84 0x01163461 in recursive_edit_1 () at keyboard.c:720
#85 0x011636cf in Frecursive_edit () at keyboard.c:789
#86 0x0115edc5 in main (argc=2, argv=0xa42848) at emacs.c:2050
Lisp Backtrace:
"c-forward-name" (0x8234a0)
"c-forward-type" (0x823e30)
"c-forward-decl-or-cast-1" (0x825240)
0x6d7e6e0 PVEC_COMPILED
"c-find-decl-spots" (0x826d30)
"c-font-lock-declarations" (0x8273c8)
"font-lock-fontify-keywords-region" (0x827b40)
"font-lock-default-fontify-region" (0x828190)
"c-font-lock-fontify-region" (0x828808)
"font-lock-fontify-region" (0x828dc8)
0x6fdbd30 PVEC_COMPILED
"run-hook-wrapped" (0x829690)
"jit-lock--run-functions" (0x829cc0)
"jit-lock-fontify-now" (0x82a3e8)
"jit-lock-function" (0x82aa68)
"redisplay_internal (C function)" (0x0)
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: File as attachment
2021-03-19 15:28 ` Eli Zaretskii
@ 2021-03-19 18:32 ` Alan Mackenzie
2021-03-20 20:30 ` Alan Mackenzie
1 sibling, 0 replies; 11+ messages in thread
From: Alan Mackenzie @ 2021-03-19 18:32 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 47191, Damien
Hello, Eli.
On Fri, Mar 19, 2021 at 17:28:03 +0200, Eli Zaretskii wrote:
> > From: Damien <dam@cosinux.org>
> > Date: Wed, 17 Mar 2021 07:48:39 +0000
> > Also here is the file as attachment to make sure it was not a copy/paste error
> Thanks.
> Emacs infloops in redisplay when visiting this file, because
> fontification of this file infloops, and that happens on the master
> branch as well, so it has nothing to do with native-compilation
> branch. The infloop seems to be in c-forward-name, I attach the
> backtrace below.
> Alan, could you please look into this?
Will do. Thanks for the backtrace!
[ .... ]
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: File as attachment
2021-03-19 15:28 ` Eli Zaretskii
2021-03-19 18:32 ` Alan Mackenzie
@ 2021-03-20 20:30 ` Alan Mackenzie
2021-03-29 9:12 ` Damien
1 sibling, 1 reply; 11+ messages in thread
From: Alan Mackenzie @ 2021-03-20 20:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: acm, 47191, Damien
Hello, Eli and Damien.
On Fri, Mar 19, 2021 at 17:28:03 +0200, Eli Zaretskii wrote:
> > From: Damien <dam@cosinux.org>
> > Date: Wed, 17 Mar 2021 07:48:39 +0000
> > Also here is the file as attachment to make sure it was not a copy/paste error
> Thanks.
> Emacs infloops in redisplay when visiting this file, because
> fontification of this file infloops, and that happens on the master
> branch as well, so it has nothing to do with native-compilation
> branch. The infloop seems to be in c-forward-name, I attach the
> backtrace below.
> Alan, could you please look into this?
[ .... ]
> Lisp Backtrace:
> "c-forward-name" (0x8234a0)
> "c-forward-type" (0x823e30)
> "c-forward-decl-or-cast-1" (0x825240)
> 0x6d7e6e0 PVEC_COMPILED
> "c-find-decl-spots" (0x826d30)
> "c-font-lock-declarations" (0x8273c8)
> "font-lock-fontify-keywords-region" (0x827b40)
> "font-lock-default-fontify-region" (0x828190)
> "c-font-lock-fontify-region" (0x828808)
> "font-lock-fontify-region" (0x828dc8)
> 0x6fdbd30 PVEC_COMPILED
> "run-hook-wrapped" (0x829690)
> "jit-lock--run-functions" (0x829cc0)
> "jit-lock-fontify-now" (0x82a3e8)
> "jit-lock-function" (0x82aa68)
> "redisplay_internal (C function)" (0x0)
The trigger for the bug was a CC Mode "name" (the return type) which was
longer than 500 characters. This 500 was a search limit introduced for
performance reasons around the turn of the year. Part of the bug was
that when a forward scanning macro (c-forward-syntactic-ws) was given a
limit less than point, point was set back to that limit, causing the
loop.
The fix involves not ever moving point backwards in
c-forward-syntactic-ws, and recalculating the 500 character limit after
scanning a template construct; template expressions can easily be very
long.
Damien, would you please try out the following patch (the files are in
..../emacs/lisp/progmodes) on your real C++ source code, and either
confirm to us that the bug is fixed, or tell us what still needs fixing.
After applying the patch, please recompile _all_ of CC Mode (the files
..../emacs/progmodes/cc-*.el), since two macros have been amended. If
you want any help with the patching or byte compiling, feel free to send
me private mail. Thanks!
Here's the patch:
diff -r 11350de71bc6 cc-defs.el
--- a/cc-defs.el Sat Mar 06 15:11:24 2021 +0000
+++ b/cc-defs.el Sat Mar 20 20:08:58 2021 +0000
@@ -656,14 +656,16 @@
LIMIT sets an upper limit of the forward movement, if specified. If
LIMIT or the end of the buffer is reached inside a comment or
-preprocessor directive, the point will be left there.
+preprocessor directive, the point will be left there. If point starts
+on the wrong side of LIMIT, it stays unchanged.
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
(if limit
- `(save-restriction
- (narrow-to-region (point-min) (or ,limit (point-max)))
- (c-forward-sws))
+ `(when (< (point) (or ,limit (point-max)))
+ (save-restriction
+ (narrow-to-region (point-min) (or ,limit (point-max)))
+ (c-forward-sws)))
'(c-forward-sws)))
(defmacro c-backward-syntactic-ws (&optional limit)
@@ -675,14 +677,16 @@
LIMIT sets a lower limit of the backward movement, if specified. If
LIMIT is reached inside a line comment or preprocessor directive then
-the point is moved into it past the whitespace at the end.
+the point is moved into it past the whitespace at the end. If point
+starts on the wrong side of LIMIT, it stays unchanged.
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
(if limit
- `(save-restriction
- (narrow-to-region (or ,limit (point-min)) (point-max))
- (c-backward-sws))
+ `(when (> (point) (or ,limit (point-min)))
+ (save-restriction
+ (narrow-to-region (or ,limit (point-min)) (point-max))
+ (c-backward-sws)))
'(c-backward-sws)))
(defmacro c-forward-sexp (&optional count)
diff -r 11350de71bc6 cc-engine.el
--- a/cc-engine.el Sat Mar 06 15:11:24 2021 +0000
+++ b/cc-engine.el Sat Mar 20 20:08:58 2021 +0000
@@ -8318,7 +8318,7 @@
;; o - nil if no name is found;
;; o - 'template if it's an identifier ending with an angle bracket
;; arglist;
- ;; o - 'operator of it's an operator identifier;
+ ;; o - 'operator if it's an operator identifier;
;; o - t if it's some other kind of name.
;;
;; This function records identifier ranges on
@@ -8338,6 +8338,7 @@
(lim+ (c-determine-+ve-limit 500)))
(while
(and
+ (< (point) lim+)
(looking-at c-identifier-key)
(progn
@@ -8387,23 +8388,28 @@
;; '*', '&' or a name followed by ":: *",
;; where each can be followed by a sequence
;; of `c-opt-type-modifier-key'.
- (while (cond ((looking-at "[*&]")
- (goto-char (match-end 0))
- t)
- ((looking-at c-identifier-start)
- (and (c-forward-name)
- (looking-at "::")
- (progn
- (goto-char (match-end 0))
- (c-forward-syntactic-ws lim+)
- (eq (char-after) ?*))
- (progn
- (forward-char)
- t))))
+ (while
+ (and
+ (< (point) lim+)
+ (cond ((looking-at "[*&]")
+ (goto-char (match-end 0))
+ t)
+ ((looking-at c-identifier-start)
+ (and (c-forward-name)
+ (looking-at "::")
+ (progn
+ (goto-char (match-end 0))
+ (c-forward-syntactic-ws lim+)
+ (eq (char-after) ?*))
+ (progn
+ (forward-char)
+ t)))))
(while (progn
(c-forward-syntactic-ws lim+)
(setq pos (point))
- (looking-at c-opt-type-modifier-key))
+ (and
+ (<= (point) lim+)
+ (looking-at c-opt-type-modifier-key)))
(goto-char (match-end 1))))))
((looking-at c-overloadable-operators-regexp)
@@ -8449,6 +8455,9 @@
;; Maybe an angle bracket arglist.
(when (let (c-last-identifier-range)
(c-forward-<>-arglist nil))
+ ;; <> arglists can legitimately be very long, so recalculate
+ ;; `lim+'.
+ (setq lim+ (c-determine-+ve-limit 500))
(c-forward-syntactic-ws lim+)
(unless (eq (char-after) ?\()
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: 28.0.50; Native compilation branch freeze in cc-mode
2021-03-17 7:47 ` Damien
@ 2021-03-22 17:01 ` Daniel Colascione
0 siblings, 0 replies; 11+ messages in thread
From: Daniel Colascione @ 2021-03-22 17:01 UTC (permalink / raw)
To: Damien, 47191
[-- Attachment #1: Type: text/plain, Size: 1774 bytes --]
On 3/17/21 3:47 AM, Damien wrote:
> So I just tested again, with recompiling with `--with-nativecompilation` and I have the exact same behavior. So maybe it is not linked to the compilation branch then. I'll try to reproduce it this weekend on master and maybe bisect it.
The following program freezes in Emacs -Q on current master. To repro,
start with emacs -Q bad-cc-mode.cpp and scroll down
> "Andrea Corallo" akrl@sdf.org – 16 mars 2021 16:35
>> Damien <dam@cosinux.org> writes:
>>
>>> Using the native compilation branch, Create tmp.cpp with this:
>>>
>>> ```
>>> // In state_machine
>>> private: auto
>>> state_machine::stop_bbbbbbb(states::recording &&s,
>>> aaaaaa::bbbbbbb_stopped_reason reason)
>>> -> fsm::state_machine<
>>> aaaaaa::bbbbbbb::state_machine,
>>> std::variant<aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_connected,
>>> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_disconnected,
>>> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_state,
>>> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_info,
>>> aaaaa::bbbb::cccccc::ddddddd::eeeeee::aaaaaa_battery,
>>> aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_error,
>>> aaaaa::bbbb::cccccc::ddddddd::eeeeee::account_valid>,
>>> std::variant<aaaaa::bbbb::aaaaaa::bbbbbbb::states::init>>::state
>>> ```
>>>
>>> Open using `emacs -Q tmp.cpp` and emacs freezes.
>> I've just compiled f3abb17118 but I can't reproduce this.
>>
>> I'm seeing you are compiling with '--with-nativecomp', we have changed
>> the flag into '--with-nativecompilation' (yeah sorry) so native
>> compilation is disable on your build (should be also listed in
>> "Configured features:" if enabled).
>>
>> Rebuilding f3abb17118 without enabling native compilation I still can't
>> reproduce this :(
>>
>> Thanks
>>
>> Andrea
>>
>>
>
>
[-- Attachment #2: bad-cc-mode.cpp --]
[-- Type: text/x-c++src, Size: 2684 bytes --]
#include <XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX>
template<XXXXXXXXXXXXXXXXXXXXXXXXXX>
XXXXXXXXX
XXXX<X, X, XXXXXXXX>::XXXX()
{
xxxxxx(xxxx, 0, xxxxxx (*xxxx));
}
xxxxxxxx<xxxxxxxx x, xxxx x, xxxx xxxxxxxx>
xxxxx<x, x, xxxxxxxx>&
xxxxx<x, x, xxxxxxxx>::xxxxxxxx=(xxx::xxxxxxxxxxx_xxxx<xxxxx_xxxx> xx)
{
xxxxxx *xxxx = xxxxx(xxx::xxxx(xx));
}
xxxxxxxx<xxxxxxxx x, xxxx x, xxxx xxxxxxxx>
xxxx
xxxxx<x, x, xxxxxxxx>::xxxx_xxxx(xxxx_x xxxx_xxx, xxxx_x xxxx_xx)
xxxxxxxx
{
xxxx_x xx = xxxx->xxxx();
xxxx_xxx_xxxxxx(xxxx->xxxxxxxx() >= xx + xxxx_xx);
xxxx_xxx_xxxxxx(xxxx_xxx <= xx);
xx (xxxx_xxx < xx && xxxx_xx) {
x* xxxx = xxxx->xxxx();
xxx (xxxx_x xxx = xx + xxxx_xx - 1; xxx >= xxxx_xxx; --xxx) {
xx (xxx >= xx)
xxx (xxxx[xxx]) x(xxx::xxxx(xxxx[xxx - xxxx_xx]));
xxxx xx (xxx >= xxxx_xxx + xxxx_xx)
xxxx[xxx] = xxx::xxxx(xxxx[xxx - xxxx_xx]);
xxxx
xxxx[xxx].~x();
}
}
}
xxxxxxxx<xxxxxxxx x, xxxx x, xxxx xxxxxxxx>
xxxx
xxxxx<x, x, xxxxxxxx>::xxxxx_xxxx(xxxx_x xxxx_xxx,
xxxx_x xxxx_xx,
xxxx_x xx_xxxxxxxxxxx)
xxxxxxxx
{
xx (!xxxx_xx)
xxxxxx;
xxxx_x xx = xxxx->xxxx();
xxxx_xxx_xxxxxx(xx_xxxxxxxxxxx <= xxxx_xx);
xxxx_xxx_xxxxxx(xxxx_xxx <= xx);
x* xxxx = xxxx->xxxx();
xxx (xxxx_x xxx = xxxx_xxx; xxx < xx + xxxx_xx; ++xxx) {
xx (xxx < xxxx_xxx + xx_xxxxxxxxxxx) {
// xx xxx xxxx xxxx xxx xxxxxxxx xx'xx xxxxxxxxxxxx xxxxxxxxxxx.
xxxx[xxx] = xxx::xxxx(xxxx[xxx + xxxx_xx]);
} xxxx xx (xxx < xxxx_xxx + xxxx_xx) {
// xxxx xxxxxxx xxxx'x xxxxxxxxxx xxxxxxxxxxx, xx xxxxxxxxx-xxx
// xxxx xxxx xx xxxxxxx.
xxx (&xxxx[xxx]) x(xxx::xxxx(xxxx[xxx + xxxx_xx]));
} xxxx xx (xxx < xx) {
// xxxx xx xxx xxxxxxx xxxxxxxx
xxxx[xxx] = xxx::xxxx(xxxx[xxx + xxxx_xx]);
} xxxx {
// xxxxxxxx xxx xxxx xxx xxx: xxxxxxx xxxx
xxxx[xxx].~x();
}
}
}
xxxxxxxx<xxxxxxxx x, xxxx x, xxxx xxxxxxxx>
xxxxxxxx<xxxxxxxx... xxxx>
xxxxxxxx xxxxx<x, x, xxxxxxxx>::xxxxxxxx
xxxxx<x, x, xxxxxxxx>::xxxxxxx(xxxxx_xxxxxxxx x, xxxx&&... xxxx)
{
// xxxx xxx xxxxx: xxxxxxxx xxxxxxxxxxx xxxxx.
xxxx_x xxx = xxx::xxxxxxxx(xxxx->xxxxxx(), x);
xxxx_x xx = xxxx->xxxx();
// xxxx xxxx xx xxx xxxxx xx xxx xxxxx xxx xxxx xx xxxx xxxx.
xxxx->xxxx(1);
xxxx->xxxx_xxxx(xxx, 1);
// xxxxxxx xxx xxxxxx xxxxxxxxx xxxxxxxxx
xxxx xxxxxxx = xxxxx;
xxxx xxxxx = xxxxxxxx::xxxxxxxxxx([&]{
xx (!xxxxxxx)
xxxx->xxxxx_xxxx(xxx, 1, 0);
});
xxx (&xxxx->xxxx()[xxx])(xxx::xxxxxxx<xxxx>(xxxx)...);
xxxxxxx = xxxx;
xxxx_xxx_xxxxx_xxx_xxxx(&xxxx->xxxxx, &xxxxx::xxxx, xx + 1);
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: File as attachment
2021-03-20 20:30 ` Alan Mackenzie
@ 2021-03-29 9:12 ` Damien
2021-03-29 15:54 ` Alan Mackenzie
0 siblings, 1 reply; 11+ messages in thread
From: Damien @ 2021-03-29 9:12 UTC (permalink / raw)
To: Eli Zaretskii, Alan Mackenzie; +Cc: acm, 47191
The patch fixes the problem for me. Also, before the patch emacs would freeze regularly due to eglot formatting the cpp function definintions when moving past one, and everything seems ok now.
Thanks a lot for helping me and fixing this !
"Alan Mackenzie" acm@muc.de – 20 mars 2021 20:30
> Hello, Eli and Damien.
>
> On Fri, Mar 19, 2021 at 17:28:03 +0200, Eli Zaretskii wrote:
> > > From: Damien <dam@cosinux.org>
> > > Date: Wed, 17 Mar 2021 07:48:39 +0000
>
> > > Also here is the file as attachment to make sure it was not a copy/paste error
>
> > Thanks.
>
> > Emacs infloops in redisplay when visiting this file, because
> > fontification of this file infloops, and that happens on the master
> > branch as well, so it has nothing to do with native-compilation
> > branch. The infloop seems to be in c-forward-name, I attach the
> > backtrace below.
>
> > Alan, could you please look into this?
>
> [ .... ]
>
> > Lisp Backtrace:
> > "c-forward-name" (0x8234a0)
> > "c-forward-type" (0x823e30)
> > "c-forward-decl-or-cast-1" (0x825240)
> > 0x6d7e6e0 PVEC_COMPILED
> > "c-find-decl-spots" (0x826d30)
> > "c-font-lock-declarations" (0x8273c8)
> > "font-lock-fontify-keywords-region" (0x827b40)
> > "font-lock-default-fontify-region" (0x828190)
> > "c-font-lock-fontify-region" (0x828808)
> > "font-lock-fontify-region" (0x828dc8)
> > 0x6fdbd30 PVEC_COMPILED
> > "run-hook-wrapped" (0x829690)
> > "jit-lock--run-functions" (0x829cc0)
> > "jit-lock-fontify-now" (0x82a3e8)
> > "jit-lock-function" (0x82aa68)
> > "redisplay_internal (C function)" (0x0)
>
> The trigger for the bug was a CC Mode "name" (the return type) which was
> longer than 500 characters. This 500 was a search limit introduced for
> performance reasons around the turn of the year. Part of the bug was
> that when a forward scanning macro (c-forward-syntactic-ws) was given a
> limit less than point, point was set back to that limit, causing the
> loop.
>
> The fix involves not ever moving point backwards in
> c-forward-syntactic-ws, and recalculating the 500 character limit after
> scanning a template construct; template expressions can easily be very
> long.
>
> Damien, would you please try out the following patch (the files are in
> ..../emacs/lisp/progmodes) on your real C++ source code, and either
> confirm to us that the bug is fixed, or tell us what still needs fixing.
> After applying the patch, please recompile _all_ of CC Mode (the files
> ..../emacs/progmodes/cc-*.el), since two macros have been amended. If
> you want any help with the patching or byte compiling, feel free to send
> me private mail. Thanks!
>
> Here's the patch:
>
>
>
> diff -r 11350de71bc6 cc-defs.el
> --- a/cc-defs.el Sat Mar 06 15:11:24 2021 +0000
> +++ b/cc-defs.el Sat Mar 20 20:08:58 2021 +0000
> @@ -656,14 +656,16 @@
>
> LIMIT sets an upper limit of the forward movement, if specified. If
> LIMIT or the end of the buffer is reached inside a comment or
> -preprocessor directive, the point will be left there.
> +preprocessor directive, the point will be left there. If point starts
> +on the wrong side of LIMIT, it stays unchanged.
>
> Note that this function might do hidden buffer changes. See the
> comment at the start of cc-engine.el for more info."
> (if limit
> - `(save-restriction
> - (narrow-to-region (point-min) (or ,limit (point-max)))
> - (c-forward-sws))
> + `(when (< (point) (or ,limit (point-max)))
> + (save-restriction
> + (narrow-to-region (point-min) (or ,limit (point-max)))
> + (c-forward-sws)))
> '(c-forward-sws)))
>
> (defmacro c-backward-syntactic-ws (&optional limit)
> @@ -675,14 +677,16 @@
>
> LIMIT sets a lower limit of the backward movement, if specified. If
> LIMIT is reached inside a line comment or preprocessor directive then
> -the point is moved into it past the whitespace at the end.
> +the point is moved into it past the whitespace at the end. If point
> +starts on the wrong side of LIMIT, it stays unchanged.
>
> Note that this function might do hidden buffer changes. See the
> comment at the start of cc-engine.el for more info."
> (if limit
> - `(save-restriction
> - (narrow-to-region (or ,limit (point-min)) (point-max))
> - (c-backward-sws))
> + `(when (> (point) (or ,limit (point-min)))
> + (save-restriction
> + (narrow-to-region (or ,limit (point-min)) (point-max))
> + (c-backward-sws)))
> '(c-backward-sws)))
>
> (defmacro c-forward-sexp (&optional count)
> diff -r 11350de71bc6 cc-engine.el
> --- a/cc-engine.el Sat Mar 06 15:11:24 2021 +0000
> +++ b/cc-engine.el Sat Mar 20 20:08:58 2021 +0000
> @@ -8318,7 +8318,7 @@
> ;; o - nil if no name is found;
> ;; o - 'template if it's an identifier ending with an angle bracket
> ;; arglist;
> - ;; o - 'operator of it's an operator identifier;
> + ;; o - 'operator if it's an operator identifier;
> ;; o - t if it's some other kind of name.
> ;;
> ;; This function records identifier ranges on
> @@ -8338,6 +8338,7 @@
> (lim+ (c-determine-+ve-limit 500)))
> (while
> (and
> + (< (point) lim+)
> (looking-at c-identifier-key)
>
> (progn
> @@ -8387,23 +8388,28 @@
> ;; '*', '&' or a name followed by ":: *",
> ;; where each can be followed by a sequence
> ;; of `c-opt-type-modifier-key'.
> - (while (cond ((looking-at "[*&]")
> - (goto-char (match-end 0))
> - t)
> - ((looking-at c-identifier-start)
> - (and (c-forward-name)
> - (looking-at "::")
> - (progn
> - (goto-char (match-end 0))
> - (c-forward-syntactic-ws lim+)
> - (eq (char-after) ?*))
> - (progn
> - (forward-char)
> - t))))
> + (while
> + (and
> + (< (point) lim+)
> + (cond ((looking-at "[*&]")
> + (goto-char (match-end 0))
> + t)
> + ((looking-at c-identifier-start)
> + (and (c-forward-name)
> + (looking-at "::")
> + (progn
> + (goto-char (match-end 0))
> + (c-forward-syntactic-ws lim+)
> + (eq (char-after) ?*))
> + (progn
> + (forward-char)
> + t)))))
> (while (progn
> (c-forward-syntactic-ws lim+)
> (setq pos (point))
> - (looking-at c-opt-type-modifier-key))
> + (and
> + (<= (point) lim+)
> + (looking-at c-opt-type-modifier-key)))
> (goto-char (match-end 1))))))
>
> ((looking-at c-overloadable-operators-regexp)
> @@ -8449,6 +8455,9 @@
> ;; Maybe an angle bracket arglist.
> (when (let (c-last-identifier-range)
> (c-forward-<>-arglist nil))
> + ;; <> arglists can legitimately be very long, so recalculate
> + ;; `lim+'.
> + (setq lim+ (c-determine-+ve-limit 500))
>
> (c-forward-syntactic-ws lim+)
> (unless (eq (char-after) ?\()
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47191: File as attachment
2021-03-29 9:12 ` Damien
@ 2021-03-29 15:54 ` Alan Mackenzie
0 siblings, 0 replies; 11+ messages in thread
From: Alan Mackenzie @ 2021-03-29 15:54 UTC (permalink / raw)
To: Damien; +Cc: 47191-done
Hello, Damien.
On Mon, Mar 29, 2021 at 09:12:32 +0000, Damien wrote:
> The patch fixes the problem for me. Also, before the patch emacs would
> freeze regularly due to eglot formatting the cpp function definintions
> when moving past one, and everything seems ok now.
That's great! Thanks for doing the testing.
> Thanks a lot for helping me and fixing this !
I've committed the fix to all the appropriate places, in particular to
the Emacs master branch at savannah. I'm closing the bug with this post.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-03-29 15:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-16 15:24 bug#47191: 28.0.50; Native compilation branch freeze in cc-mode Damien
2021-03-16 16:35 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-17 7:07 ` Damien
2021-03-17 7:47 ` Damien
2021-03-22 17:01 ` Daniel Colascione
2021-03-17 7:48 ` bug#47191: File as attachment Damien
2021-03-19 15:28 ` Eli Zaretskii
2021-03-19 18:32 ` Alan Mackenzie
2021-03-20 20:30 ` Alan Mackenzie
2021-03-29 9:12 ` Damien
2021-03-29 15:54 ` Alan Mackenzie
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.