Subject: 28.0.50; defconst lacks a safety net
From: Stephen Berman <[email-masked]>
To: [email-masked]
Date: Thu, 11 Jun 2020 23:10:07 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

0. emacs -Q
1. In *scratch* type: (defvar 'bla "bla") C-j
=> Debugger entered--Lisp error: (wrong-type-argument symbolp 'bla)
2. In *scratch* type: (defconst 'bla "bla") C-j
=> 🤯
Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
Finternal__define_uninitialized_variable (symbol=symbol@entry=0x14ee4f3, 
    doc=0x0) at /home/steve/src/emacs/emacs-master/src/lisp.h:1010

diff --git a/src/eval.c b/src/eval.c
index 959adea646..171d0644cc 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -831,6 +831,8 @@ DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
   Lisp_Object sym, tem;
 
   sym = XCAR (args);
+  CHECK_SYMBOL (sym);
+
   Lisp_Object docstring = Qnil;
   if (!NILP (XCDR (XCDR (args))))
     {

In GNU Emacs 28.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.24.17, cairo version 1.17.3)
 of 2020-06-11 built on strobe-jhalfs
Repository revision: d8a6d2e4810a4072cabbf76170dc4bf708f27d10
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Linux From Scratch SVN-20200401

Configured using:
 'configure 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'

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

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