Subject: 27.0.50; Semantic mode for Python causes segmentation fault

From: Stuart <[email-masked]>
Date: Fri, 20 Apr 2018 18:20:07 -0600

Emacs segfaults when semantic-mode is enabled in a python buffer. To
reproduce this, place the python code below into a file. I called it 
'the_file.py'.
Then run 'emacs -Q the_file.py', then 'M-x semantic-mode'.

Here's the contents of a file that emacs crashes on:

import sys
import re

def foo(x):
     print(x)
     print("Hello world!")

def bar(x):
     print("I'm a teapot")

class emacs_bug:

     def __init__():
         pass

Output from gdb:

(gdb) run -Q the_file.py
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/local/bin/emacs -Q asdf.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffebceb700 (LWP 13170)]
[New Thread 0x7fffeb077700 (LWP 13171)]
[New Thread 0x7fffea876700 (LWP 13172)]
Detaching after vfork from child process 13173.
Detaching after vfork from child process 13174.

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
0x000000000057c72e in XCDR (c=0x0) at lisp.h:1311
1311 return lisp_h_XCDR (c);

In GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, Xaw 
scroll bars)
of 2018-04-20 built on linux.local
Repository revision: 495963cfaf535646350051f47c085b84319572f0
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: openSUSE Tumbleweed

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
'configure --with-x-toolkit=lucid --with-modules'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 MODULES
THREADS LIBSYSTEMD JSON

Important settings:
value of $LC_CTYPE: en_US.UTF-8
value of $LANG: en_US.utf8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
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
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:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date elec-pair
mule-util 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 menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame 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 minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 98897 9202)
(symbols 48 20073 1)
(miscs 40 152 120)
(strings 32 29441 2024)
(string-bytes 1 776368)
(vectors 16 15787)
(vector-slots 8 537860 13692)
(floats 8 50 67)
(intervals 56 272 12)
(buffers 992 12))