Subject: bug#39577: 27.0.60; Assertion failed during compilation

From: Eli Zaretskii <[email-masked]>
Date: Thu, 13 Feb 2020 16:57:26 +0200

> Date: Wed, 12 Feb 2020 08:39:58 +0100
> From: Henrik Grimler <[email-masked]>
> 
> ../configure --enable-checking=yes,glyphs \
> --enable-check-lisp-object-type \
> --without-makeinfo \
> --without-selinux \
> --prefix /data/data/com.termux/files/usr/local \
> CFLAGS="-O0 -g3 -gdwarf-4"
> ```
> 
> but building the emacs-27 branch (commit 06c302d) this fails with:
> 
> ```
> [...]
> Loading /data/data/com.termux/files/home/projects/emacs/lisp/emacs-lisp/syntax.el (source)...
> Loading /data/data/com.termux/files/home/projects/emacs/lisp/font-lock.el (source)...
> Loading /data/data/com.termux/files/home/projects/emacs/lisp/jit-lock.el (source)...
> 
> ../../src/fns.c:2856: Emacs fatal error: assertion failed: !FIXNUM_OVERFLOW_P (lisp_h_make_fixnum_n)

This would mean that the values returned by getloadavg on that system
are preposterously large.  Can you run the offending command under a
debugger, put a breakpoint on line 2856 of fns.c, and see what values
you get in the load_ave[] array?

> This (as well as the segfault) happens both if compiling with clang 9.0.1 and gcc 9.2.0.
> I get a warning earlier multiple times that might be related:
> 
> ```
> [...]
>   CC       dispnew.o
> In file included from ../../src/dispnew.c:29:
> In file included from ../../src/termchar.h:23:
> ../../src/dispextern.h:1917:36: warning: signed shift result (0x3FFFFC00000) requires 43 bits to represent, but 'EMACS_INT' (aka 'int') only has 32 bits [-Wshift-overflow]
>                ? ((EMACS_INT) MAX_FACE_ID << CHARACTERBITS) | MAX_CHAR
>                   ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
> 1 warning generated.

I think this warning is bogus, since if your EMACS_INT is not wide
enough to hold MAX_FACE_ID shifted left by 8 bits, the code will not
do that.

> If I remove --enable-checking=yes,glyphs it builds (I am sending this
> bug report from that build) but gets segmentation faults every now and
> then. Easiest way to trigger it is to scroll up and down in some file,
> but it still happens randomly, maybe after 200 lines, maybe after 10
> 000.

Can you show a backtrace from the segfault?