Subject: Re: bug#9713: emacs 24.0.90 alloc.c assertion failure

From: [email-masked] (Karl Berry)
Date: Tue, 11 Oct 2011 17:55:11 GMT

x86_64 Scientific Linux 5.7

I am compiling on 32-bit, not 64-bit.  Perhaps that is the difference.

    The system has

I have exactly those same values in the same headers.  However, running
gcc -dD -E on alloc.c (after configuration, with all the same args as
used for compilation) shows that those values are not being used.

Instead, Emacs's (gnulib's) lib/stdint.h is being used (why?), which
unconditionally redefines PTRDIFF_MAX as _STDINT_MAX, which is defined
in that same file as the RHS here (the LHS is the recognizable value of
INT_MAX):

_Static_assert (2147483647 <= ((1) ? ~ ((1) ? (- ((0) + 1) << ((0) ? (0) - 1 : 0)) : (0)) : ((((0) + 1) << ((0) ? (0) - 1 - (1) : 0)) - 1) * 2 + 1), "verify (" "INT_MAX <= PTRDIFF_MAX" ")");

FWIW, if I reduce the input file to these four lines:
#include <config.h>
#include "lisp.h"
#include <verify.h>
verify (INT_MAX <= PTRDIFF_MAX);

And compile with all the same options, I get the same error from verify
(along with a spurious error about jmp_buf).  Without "lisp.h",
PTRDIFF_MAX is not defined.

Here is my full command line:
gcc -std=gnu99 -c -Demacs -DHAVE_CONFIG_H \
-I. -I/usr/local/gnu/src/emacs-24.0.90/src -I../lib \
-I/usr/local/gnu/src/emacs-24.0.90/src/../lib   -I/usr/include/gtk-2.0 \
-I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo \
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 \
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2 \
-I/usr/include/libpng12   -I/usr/include/freetype2 \
-I/usr/include/alsa   -I/usr/include/librsvg-2 -I/usr/include/glib-2.0 \
-I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 \
-I/usr/include/libxml2   -I/usr/include/dbus-1.0 \
-I/usr/lib/dbus-1.0/include   -DORBIT2=1 -pthread -I/usr/include/gconf/2 \
-I/usr/include/orbit-2.0 -I/usr/include/glib-2.0 \
-I/usr/lib/glib-2.0/include   -I/usr/include/freetype2      -MMD -MF \
deps/alloc.d -MP   -Wimplicit-function-declaration \
-Wold-style-definition -Wdeclaration-after-statement  -g -O2 alloc.c

karl