Subject: Building Emacs BZR with GCC 4.5.0

From: Vladimir Lomov <[email-masked]>
Date: Mon, 26 Apr 2010 23:33:29 +0900

Hi.

(Some response to #6031, http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6031)

I'm trying to compile Emacs from BZR using gcc 4.5.0
$ bzr revno
100035

Compilation went ok but when I try to run Emacs it segfault'ed.

Here what I see running compiled Emacs in gdb:
=========================================================================================
$ gdb ./emacs
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/USER/tmp/src/emacs-bzr/src/emacs...done.
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not
from terminal]
DISPLAY = :0.0
TERM = xterm
Breakpoint 1 at 0x4e7510: file emacs.c, line 430.
Temporary breakpoint 2 at 0x504090: file sysdep.c, line 1118.
(gdb) run -Q -D
Starting program: /home/USER/tmp/src/emacs-bzr/src/emacs -Q -D
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
fill_stretch_glyph_string (s=<value optimized out>, start=<value
optimized out>, end=<value optimized out>, s=<value optimized out>,
    start=<value optimized out>, end=<value optimized out>) at xdisp.c:20842
20842	  s->font = s->face->font;
(gdb) bt
#0  fill_stretch_glyph_string (s=<value optimized out>, start=<value
optimized out>, end=<value optimized out>, s=<value optimized out>,
    start=<value optimized out>, end=<value optimized out>) at xdisp.c:20842
#1  0x0000000000445d44 in draw_glyphs (w=0xfb98e0, x=10, row=<value
optimized out>, area=TEXT_AREA, start=0, end=1, hl=DRAW_CURSOR,
    overlaps=0) at xdisp.c:21384
#2  0x000000000044b330 in draw_phys_cursor_glyph (w=0xfb98e0,
row=0x128f550, hl=DRAW_CURSOR) at xdisp.c:23566
#3  0x00000000004a51a0 in x_draw_window_cursor (w=0xfb98e0,
glyph_row=0x128f550, x=0, y=60, cursor_type=<value optimized out>,
    cursor_width=<value optimized out>, on_p=1, active_p=1) at xterm.c:7514
#4  0x000000000044ba63 in display_and_set_cursor (w=0xfb98e0, on=1,
hpos=<value optimized out>, vpos=<value optimized out>, x=0, y=60)
    at xdisp.c:23790
#5  0x00000000004a6d04 in x_update_window_end (w=0xfb98e0,
cursor_on_p=<value optimized out>, mouse_face_overwritten_p=0) at
xterm.c:650
#6  0x0000000000416992 in update_window (w=<value optimized out>,
force_p=<value optimized out>) at dispnew.c:3984
#7  0x0000000000417d43 in update_window_tree (w=0xfb98e0, force_p=0)
at dispnew.c:3613
#8  0x000000000041b573 in update_frame (f=0xfb8c80, force_p=0,
inhibit_hairy_id_p=0) at dispnew.c:3540
#9  0x000000000043f51c in redisplay_internal
(preserve_echo_area=<value optimized out>) at xdisp.c:12243
#10 0x00000000004f5382 in read_char (commandflag=1, nmaps=2,
maps=0x7fffffffd430, prev_event=12421458,
used_mouse_menu=0x7fffffffd53c,
    end_time=0x0) at keyboard.c:2576
#11 0x00000000004f790c in read_key_sequence (keybuf=<value optimized
out>, prompt=12421458, dont_downcase_last=0,
    can_return_switch_frame=1, fix_current_buffer=1, bufsize=30) at
keyboard.c:9402
#12 0x00000000004f9759 in command_loop_1 () at keyboard.c:1636
#13 0x000000000055d00f in internal_condition_case (bfun=0x4f9590
<command_loop_1>, handlers=12473314, hfun=0x4ecc70 <cmd_error>)
    at eval.c:1512
#14 0x00000000004ec2fe in command_loop_2 () at keyboard.c:1356
#15 0x000000000055ceea in internal_catch (tag=12469394, func=0x4ec2e0
<command_loop_2>, arg=12421458) at eval.c:1248
#16 0x00000000004ece71 in command_loop () at keyboard.c:1335
#17 0x00000000004ecf0a in recursive_edit_1 () at keyboard.c:950
#18 0x00000000004ed047 in Frecursive_edit () at keyboard.c:1012
#19 0x00000000004e8da7 in main (argc=<value optimized out>,
argv=<value optimized out>) at emacs.c:1784
(gdb) quit
=========================================================================================

The same happens with emacs-23.1.96 (taken from
ftp://alpha.gnu.org/gnu/emacs/pretest/):
=========================================================================================
$ gdb ./emacs
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/USER/tmp/emacs-23.1.96/src/emacs...done.
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not
from terminal]
DISPLAY = :0.0
TERM = xterm
Breakpoint 1 at 0x4e1480: file emacs.c, line 430.
Temporary breakpoint 2 at 0x4fe790: file sysdep.c, line 1129.
(gdb) run -Q -D
Starting program: /home/USER/tmp/emacs-23.1.96/src/emacs -Q -D
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
fill_stretch_glyph_string (s=<value optimized out>, start=<value
optimized out>, end=<value optimized out>, s=<value optimized out>,
    start=<value optimized out>, end=<value optimized out>) at xdisp.c:19755
19755	  s->font = s->face->font;
(gdb) bt
#0  fill_stretch_glyph_string (s=<value optimized out>, start=<value
optimized out>, end=<value optimized out>, s=<value optimized out>,
    start=<value optimized out>, end=<value optimized out>) at xdisp.c:19755
#1  0x0000000000443f84 in draw_glyphs (w=0x1165820, x=10, row=<value
optimized out>, area=TEXT_AREA, start=0, end=1, hl=DRAW_CURSOR,
    overlaps=0) at xdisp.c:20297
#2  0x000000000044952c in draw_phys_cursor_glyph (w=0x1165820,
row=0x11fd1b0, hl=DRAW_CURSOR) at xdisp.c:22406
#3  0x000000000049ff10 in x_draw_window_cursor (w=0x1165820,
glyph_row=0x11fd1b0, x=0, y=60, cursor_type=<value optimized out>,
    cursor_width=<value optimized out>, on_p=1, active_p=1) at xterm.c:7510
#4  0x0000000000449c6b in display_and_set_cursor (w=0x1165820, on=1,
hpos=<value optimized out>, vpos=<value optimized out>, x=0, y=60)
    at xdisp.c:22628
#5  0x00000000004a1a54 in x_update_window_end (w=0x1165820,
cursor_on_p=<value optimized out>, mouse_face_overwritten_p=0) at
xterm.c:652
#6  0x000000000041680d in update_window (w=<value optimized out>,
force_p=<value optimized out>) at dispnew.c:4375
#7  0x0000000000417bb3 in update_window_tree (w=0x1165820, force_p=0)
at dispnew.c:4004
#8  0x000000000041c068 in update_frame (f=0x11655d0, force_p=0,
inhibit_hairy_id_p=0) at dispnew.c:3931
#9  0x000000000043d8dc in redisplay_internal
(preserve_echo_area=<value optimized out>) at xdisp.c:11826
#10 0x00000000004ef892 in read_char (commandflag=1, nmaps=2,
maps=0x7fffffffd450, prev_event=11659666,
used_mouse_menu=0x7fffffffd55c,
    end_time=0x0) at keyboard.c:2727
#11 0x00000000004f1e1c in read_key_sequence (keybuf=<value optimized
out>, prompt=11659666, dont_downcase_last=0,
    can_return_switch_frame=1, fix_current_buffer=1, bufsize=30) at
keyboard.c:9512
#12 0x00000000004f3c71 in command_loop_1 () at keyboard.c:1643
#13 0x000000000055717f in internal_condition_case (bfun=0x4f3aa0
<command_loop_1>, handlers=11726930, hfun=0x4e7450 <cmd_error>)
    at eval.c:1490
#14 0x00000000004e629e in command_loop_2 () at keyboard.c:1360
#15 0x000000000055705a in internal_catch (tag=11719746, func=0x4e6280
<command_loop_2>, arg=11659666) at eval.c:1226
#16 0x00000000004e7651 in command_loop () at keyboard.c:1339
#17 0x00000000004e76ea in recursive_edit_1 () at keyboard.c:954
#18 0x00000000004e7827 in Frecursive_edit () at keyboard.c:1016
#19 0x00000000004e2d27 in main (argc=<value optimized out>,
argv=<value optimized out>) at emacs.c:1833
(gdb) quit
=========================================================================================

In both cases configure script was run with options:
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
--mandir=$HOME/tmp/emacs --libexecdir=/usr/lib --with-xpm --with-jpeg
--with-tiff --with-gif --with-png --with-rsvg --with-x-toolkit=gtk
--with-xft --with-libotf --with-dbus --without-sound
--enable-maintainer-mode

OS: Archlinux x86_64
GCC: 4.5.0

I also tried to compile Emacs (BZR) with gcc 4.4.3 ( the same distro
but a bit outdated). After compilation I managed to run Emacs
(terminal session).

Seems that with gcc 4.4
(http://bugs.gentoo.org/show_bug.cgi?id=317187) Emacs could be
compiled and run without errors.

---
WBR, Vladimir Lomov