Subject: 28.0.50; hang in c++ font lock

From: Matt Liberty <[email-masked]>
Date: Thu, 1 Apr 2021 10:11:03 -0700

If I open the file below and goto-line to line 54 ("X X()") then emacs
hangs.
I sent a SIGUSR2 and I see:
Debugger entered--entering a function:
* #f(compiled-function () #<bytecode 0x1c83247378ca389b>)()
  font-lock-default-fontify-region(1217 1227 nil)
  c-font-lock-fontify-region(1217 1227 nil)
  font-lock-fontify-region(1217 1227)
  #f(compiled-function (fun) #<bytecode
0x1f37dc2e6f385ebe>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode
0x1f37dc2e6f385ebe>) font-lock-fontify-region)
  jit-lock--run-functions(1217 1227)
  jit-lock-fontify-now(1217 1717)
  jit-lock-function(1217)
  redisplay_internal\ \(C\ function\)()

Sometimes I can C-g successfully but any attempt to edit the line hangs
again.  If I switch to text-mode before goto-line then there is no hang.

The file is:  (obfuscated)
x(x* x, x* x, x* x, x* x)
{
  ;

  for (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) {
    ;
    if (xxxxxxxxx) {      ;    }
  }

  if (xxxxxxxxxxx > x) {
    xxxxxxxxxxxxx(xxx, xxx,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    xxxxxxxxxxxxxxx;
  }

  xxxxxxxxxxxxxxxxxxxxxxxxxxxx;
}

xxxx xxxxxxxxxxxxxxxxxxxxxxxxx(xxxxxxxxxxxxxxxx* xxxxx, xxxxxxxxxxxx&
xxxxxxx)
{
  xxxxxxxxxxxxxxxxxxx;
  if (xxxxxxxxxxxxxxxx) {
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
    for (xxxxxxxxxxxxxxxxx) {
      if (xxxxxxxxxxxxxxxxxxxx) {
        xxxxxxxx;
      }
      xxxxxxxxxxxxxxxx(
          {xxxxxxxxxxxxxx, xxxxxxxxxxxxxxxx, xxxxxxxxxxxxxxx,
xxxxxxxxxxxxx});
    }
  }

  if (!xxxx) {
    xxxxxx;
  }

  xxxxxxxx = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
  if (xxxxxxxx < 0) {
    xxxxxx;
  }

  for (xxxxx xxxx& xx : xxxx) {
    if (xxxxxxxxxxxxxxxx != xxxxxxxx) {
      xxxxxxxx;
    }
    xxxx xxxxx = xxxxxxxxxxxxxx ? xxxxxxxxxxxxxxxxxxx : xxxxxxxxxxxxxxxxx;
    xxxxxxxxxxxxxx(xxxxx, /* xxxxxxxx */ xxxx);

    xxxxxxx xx = xxxxxxxxxxxxx;
    xxxxxxxxxxxxxxxx({xxxxxx - xx, xxxxxx - xx}, {xxxxxx + xx, xxxxxx +
xx});
    xxxxxxxxxxxxxxxx({xxxxxx - xx, xxxxxx + xx}, {xxxxxx + xx, xxxxxx -
xx});
  }
}

x x()
{
}

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30,
cairo version 1.15.12)
 of 2021-03-16 built on or-3.ucsd.edu
Repository revision: f5e1fc371af7a4211ca7a40b5db0b7da00cb1d93
Repository branch: heads/emacs-27.1
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: CentOS Linux 7 (Core)

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG MODULES
NOTIFY INOTIFY PDUMPER PNG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11
XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: C
  locale-coding-system: nil

Major mode: Lisp

Minor modes in effect:
  display-time-mode: t
  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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa epg 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 seq byte-opt gv 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 time-date subr-x help-fns radix-tree
cl-print debug backtrace help-mode find-func 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 jka-compr cmake-mode thingatpt
derived rx info ange-ftp comint ansi-color ring edmacro kmacro
cl-loaddefs cl-lib time 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 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 93647 5709)
 (symbols 48 11517 1)
 (strings 32 32919 1212)
 (string-bytes 1 1168442)
 (vectors 16 19248)
 (vector-slots 8 243569 8479)
 (floats 8 46 121)
 (intervals 56 508 0)
 (buffers 992 14)
 (heap 1024 14660 1081))