Subject: bug#51692: 29.0.50; High CPU in c++ mode. Type finder?

From: David Koppelman <[email-masked]>
Date: Mon, 08 Nov 2021 13:00:06 -0600

Load the attached file into a buffer:

./src/emacs --no-init d.cc

Emacs will use 100% CPU on a core while the buffer is visible. CPU usage
goes to normal when switching to another buffer. The attached file is a
reduced version of a much larger file. (The larger file experiences the
high CPU usage only while a certain portion of the code is visible.)

In GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.12)
 of 2021-11-08 built on cyc.ece.lsu.edu
Repository revision: 5861b8d027382ecbd4c0d3dffc283b8ac95b5692
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Red Hat Enterprise Linux 8.4 (Ootpa)

Configured using:
 'configure
 PATH=/opt/gnu/gcc11/bin:/bin:/usr/bin:/opt/local/bin:/usr/local/bin:/home/faculty/koppel/scripts:/home/faculty/koppel/r/ga/simtools/bin:/home/faculty/koppel/lbin:/home/apps/bin:/usr/kerberos/bin:/usr/X11R6/bin:/usr/local/cuda/bin:/usr/sbin:/apps/linux/cadence/GENUS211/bin:/apps/linux/cadence/SPECTRE211/tools/bin:/apps/linux/cadence/SPECTRE211/bin:/apps/linux/cadence/SPECTRE191/tools/bin:/apps/linux/cadence/SPECTRE191/bin:/apps/linux/cadence/XCELIUM2103/tools/bin/64bit:/apps/linux/cadence/XCELIUM2103/tools/bin:/apps/linux/cadence/XCELIUM2103/bin:/apps/linux/cadence/IC618/tools/bin:/apps/linux/cadence/IC618/bin:/opt/torque/bin:/extra/localpri/build/depot_tools:/usr/lib64/openmpi/bin:/apps/linux/Mathematica/Executables:/opt/gnu/gcc11/bin:/opt/pgi/linux86-64/17.10/bin
 LD_LIBRARY_PATH=/opt/gnu/gcc11/lib:/opt/gnu/gcc11/lib64:
 CC=/opt/gnu/gcc11/bin/gcc 'CFLAGS=-march=native -O2' --without-pop
 --with-native-compilation'

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

Important settings:
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C++//l

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
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug comp comp-cstr warnings rx cl-extra
message mailcap yank-media rmc puny dired dired-loaddefs rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
seq gv subr-x byte-opt bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils vc-git
diff-mode easy-mmode vc-dispatcher cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs help-mode
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 129683 8659)
 (symbols 48 10727 1)
 (strings 32 32890 2419)
 (string-bytes 1 1161589)
 (vectors 16 20723)
 (vector-slots 8 397379 17246)
 (floats 8 42 38)
 (intervals 56 413 0)
 (buffers 992 14))