Because I'm insane, I compile XEmacs with C++ compilers. I get a
crash when building with egcs-20000131 c++. I believe this to be a
bug in the compiler, not my code, because:
- the crash is in stable code that works with many other C and C++
compilers, including the ones in gcc-2.95.2, and the C compiler in
20000131.
- The crash goes away if inlining is disabled by:
- compiling with `c++ -O3 -fno-inline'
- compiling with `c++ -O2'
- adding a do-nothing alloca(4) call to the suspect function.
- The function being inlined causing the problem does something
perhaps likely to provoke a compiler inlining bug, namely inlining a
function which itself inlines a function with 6 parameters.
If you'd like to fix this, access to my machine is available on
request. Unfortunately, creating a small test case is going to be tough.
shell transcript follows:
(martin@lasker) /xemacs/build/moS+/src $ rm *.o; make 'CFLAGS=-g' temacs >
/dev/null 2>&1
(martin@lasker) /xemacs/build/moS+/src $ rm minibuf.o; make 'CFLAGS=-v -O3 -g'
temacs
/hack/import/egcs-20000131/inst/linux-libc2/bin/c++ -c -v -O3 -g -Demacs -I.
-DHAVE_CONFIG_H -I/usr/local/include -I/usr/X11R6/include /xemacs/ws/dev/src/minibuf.c
Reading specs from
/hack/import/egcs-20000131/inst/linux-libc2/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 20000131 (experimental)
/hack/import/egcs-20000131/inst/linux-libc2/lib/gcc-lib/i686-pc-linux-gnu/2.96/cpp
-lang-c++ -v -I. -I/usr/local/include -I/usr/X11R6/include -D__GNUC__=2 -D__GNUG__=2
-D__GNUC_MINOR__=96 -D__cplusplus -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -D__OPTIMIZE__ -g
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_pentiumpro__ -Demacs
-DHAVE_CONFIG_H /xemacs/ws/dev/src/minibuf.c /tmp/cciU4cP7.ii
cpp: GNU CPP version 2.96 20000131 (experimental) (cpplib) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/include
/usr/X11R6/include
/hack/import/egcs-20000131/inst/include/g++-3
/hack/import/egcs-20000131/inst/include
/hack/import/egcs-20000131/inst/linux-libc2/i686-pc-linux-gnu/include
/hack/import/egcs-20000131/inst/linux-libc2/lib/gcc-lib/i686-pc-linux-gnu/2.96/include
/usr/include
End of search list.
/hack/import/egcs-20000131/inst/linux-libc2/lib/gcc-lib/i686-pc-linux-gnu/2.96/cc1plus
/tmp/cciU4cP7.ii -quiet -dumpbase minibuf.cc -g -O3 -version -o /tmp/ccdF1gvf.s
GNU C++ version 2.96 20000131 (experimental) (i686-pc-linux-gnu) compiled by GNU C version
egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
as -V -Qy -o minibuf.o /tmp/ccdF1gvf.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.23
/hack/import/egcs-20000131/inst/linux-libc2/bin/c++ -nostdlib -L/usr/local/lib
-L/usr/X11R6/lib -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o abbrev.o alloc.o
blocktype.o buffer.o bytecode.o callint.o callproc.o casefiddle.o casetab.o chartab.o
cmdloop.o cmds.o console.o console-stream.o data.o device.o dired.o doc.o doprnt.o
dynarr.o editfns.o elhash.o emacs.o eval.o events.o unexelf.o dgif_lib.o gif_io.o
menubar.o scrollbar.o dialog.o toolbar.o menubar-x.o scrollbar-x.o dialog-x.o toolbar-x.o
gui-x.o mule.o mule-ccl.o mule-charset.o file-coding.o input-method-xlib.o realpath.o
getloadavg.o inline.o linuxplay.o esd.o miscplay.o console-tty.o device-tty.o event-tty.o
frame-tty.o objects-tty.o redisplay-tty.o cm.o terminfo.o gpmevent.o event-unixoid.o
sysdll.o emodules.o process-unix.o event-stream.o extents.o faces.o fileio.o filemode.o
floatfns.o fns.o font-lock.o frame.o general.o glyphs.o glyphs-eimage.o glyphs-widget.o
gui.o gutter.o hash.o imgproc.o indent.o insdel.o intl.o keymap.o line-number.o lread.o
lstream.o macros.o marker.o md5.o minibuf.o objects.o opaque.o print.o process.o profile.o
rangetab.o redisplay.o redisplay-output.o regex.o search.o select.o signal.o sound.o
specifier.o strftime.o symbols.o syntax.o sysdep.o undo.o balloon_help.o balloon-x.o
console-x.o device-x.o event-Xt.o frame-x.o glyphs-x.o objects-x.o redisplay-x.o
select-x.o xgccache.o widget.o window.o lastfile.o vm-limit.o ralloc.o EmacsFrame.o
EmacsShell.o TopLevelEmacsShell.o TransientEmacsShell.o EmacsManager.o ../lwlib/liblw.a
-lXaw -ltiff -lpng -ljpeg -lz -lcompface -lXpm -lXmu -lXt -lXext -lX11 -lSM -lICE -ldl
-lgpm -lncurses -L/usr/lib -lesd -laudiofile -lm -lm -lgcc -lc -lgcc /usr/lib/crtn.o
`/hack/import/egcs-20000131/inst/linux-libc2/bin/c++ -print-libgcc-file-name`
(martin@lasker) /xemacs/build/moS+/src $ gdb temacs
GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) dump-temacs
Using load-path (../lisp/ ..)
Using module-load-path (../modules/ ..)
Fatal error: assertion failed, file /xemacs/ws/dev/src/alloc.c, line 1858, length >= 0
&& fullsize > 0
Program received signal SIGABRT, Aborted.
0x40293111 in __kill ()
(gdb) where 10
#0 0x40293111 in __kill ()
#1 0x40292d66 in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2 0x40294447 in abort () at ../sysdeps/generic/abort.c:88
#3 0x808cab1 in assert_failed () at /xemacs/ws/dev/src/emacs.c:2818
#4 0x80541fa in make_uninit_string__Fl (length=-1) at /xemacs/ws/dev/src/alloc.c:1858
#5 0x8054a11 in make_string__FPCUcl (contents=0x83cd4e4 "Loading
/xemacs/build/moS+/lisp/keydefs.elc...", length=-1) at
/xemacs/ws/dev/src/alloc.c:2112
#6 0x8146e2e in echo_area_message__FP5framePCUcllll (f=0x8309658, nonreloc=0x0,
reloc=137949116, offset=0, length=-1, label=136927892) at
/xemacs/ws/dev/src/minibuf.c:735
#7 0x81470d8 in message__FPCce (fmt=0x81f6668 "Loading %s...") at
/xemacs/ws/dev/src/minibuf.c:805
#8 0x813b329 in Fload_internal__Fllllll (file=137939196, no_error=136809468,
nomessage=136809468, nosuffix=136809468, codesys=136809468, used_codesys=136809468) at
/xemacs/ws/dev/src/lread.c:674
#9 0x8092a0a in Feval__Fl (form=137435512) at /xemacs/ws/dev/src/eval.c:2974
(More stack frames follow...)