Subject: bug#62875: 28.2; Crash on MacOS/M1 with treesitter enabled

From: Drew Moseley <[email-masked]>
Date: Sat, 15 Apr 2023 15:17:19 -0400

Start with 'emacs -Q' on MacOS with an M1 chip.  I specifically used the
prebuilt binaries from https://emacsformacosx.com/builds.  I could
reproduce this with the latest stable release, as well as with
Emacs-pretest-29.0.90-universal and a nightly with version 30.0.50.

Load the following elisp code:

   (require 'package)
   (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
   (package-refresh-contents)
   (package-initialize)
   (package-install 'tree-sitter)
   (global-tree-sitter-mode)

Then press 'Control-Command-D' and Emacs will crash with the following
in the terminal:

   $ ./Downloads/Emacs-30.0.50.app/Contents/MacOS/Emacs -Q
   Fatal error 5: Trace/breakpoint trap
   Abort trap: 6

I tried to run Emacs under lldb to get a backtrace but it seems that
requires disabling system integrity protection and when I did that,
the error no longer occurred.

There is quite a bit of info in the MacOS bug report log but I'm not
sure if that is helpful or not. If so, I'll be happy to provide it.

Regards,
Drew Moseley

In GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build 21A559))
of 2023-02-22 built on armbob.lan
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.3.1

Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules --with-x-toolkit=no'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB

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

Major mode: Text

Minor modes in effect:
  global-tree-sitter-mode: t
  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:
(mailalias mailclient help-mode shadow sort mail-extr emacsbug sendmail
cus-edit pp cus-start cus-load wid-edit tree-sitter tree-sitter-load
tree-sitter-cli tsc tsc-dyn tsc-dyn-get compile comint ansi-color ring
dired-aux tsc-obsolete finder-inf 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 tree-sitter-autoloads tsc-autoloads 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 paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win 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 kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 264444 21801)
(symbols 48 16324 6)
(strings 32 86035 3338)
(string-bytes 1 2184630)
(vectors 16 25442)
(vector-slots 8 357294 30019)
(floats 8 43 388)
(intervals 56 1092 0)
(buffers 992 12))