Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 135718 - [4.1/wrong-code] building xterm with -Os breaks color display
Summary: [4.1/wrong-code] building xterm with -Os breaks color display
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/PR28386
Whiteboard:
Keywords:
: 127346 142198 146442 147163 147401 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-05 23:04 UTC by Jack Kelly
Modified: 2006-09-15 12:03 UTC (History)
10 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
shortened example (test.c,215 bytes, text/plain)
2006-07-12 23:44 UTC, Harald van Dijk (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Kelly 2006-06-05 23:04:30 UTC
When an xterm which is built with GCC 4.1 is started, the following output (or similar garbage characters) is written to stderr:

xterm: Cannot allocate color ;GuD$GT
Comment 1 Jack Kelly 2006-06-05 23:04:30 UTC
When an xterm which is built with GCC 4.1 is started, the following output (or similar garbage characters) is written to stderr:

xterm: Cannot allocate color ;GuD$GTº

Gterm: Cannot allocate color j
éU

and the terminal fails to display colour.

This behaviour does not happen under gcc 3.4.6 and can be worked around like so:
gcc-config i686-pc-linux-gnu-3.4.6 && source /etc/profile && emerge -1 xterm && gcc-config i686-pc-linux-gnu-4.1.1 && source /etc/profile

emerge --info follows:

Portage 2.1_rc4 (default-linux/x86/2006.0, gcc-4.1.1, glibc-2.4-r3, 2.6.16-gentoo-r9 i686)
=================================================================
System uname: 2.6.16-gentoo-r9 i686 Genuine Intel(R) CPU           T2400  @ 1.83GHz
Gentoo Base System version 1.12.0
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS=" -march=prescott -Os -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS=" -march=prescott -Os -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.planetmirror.com/pub/gentoo/ ftp://ftp.swin.edu.au/gentoo http://ftp.swin.edu.au/gentoo"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://urr/gentoo-portage"
USE="x86 X alsa apm arts avi bash-completion berkdb bitmap-fonts cli crypt dri eds emacs emboss encode esd foomaticdb fortran gdbm gif gpm gstreamer imlib ipv6 isdnlog jpeg libg++ libwww mad mikmod mmx motif mp3 mpeg ncurses nptl nptlonly ogg opengl oss pam pcre pdflib perl png pppd python quicktime readline reflection sdl session spell spl sse sse2 ssl symlink tcpd truetype truetype-fonts type1-fonts udev vorbis winbind xml xmms xorg xv zlib elibc_glibc input_devices_keyboard input_devices_mouse kernel_linux userland_GNU video_cards_nv video_cards_nvidia video_cards_vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS

xorg, gcc and xterm versions:
xorg-x11-7.0-r1 (with hand masked packages so nvidia binary drivers were not blocked:)
=x11-base/xorg-server-1.1.0
=x11-base/xorg-x11-7.1
=x11-drivers/xf86-video-vesa-1.2.0
=x11-drivers/xf86-input-keyboard-1.1.0
=x11-drivers/xf86-input-mouse-1.1.1
=x11-drivers/xf86-video-nv-1.1.2
=x11-drivers/xf86-video-vesa-1.2.1
gcc-4.1.1 and gcc-3.4.6-r1
xterm-213-r1 (observed also with version 213, 212-r3 207-r1)

Steps to reproduce:
1. emerge gcc 4.1
2. emerge xterm
3. attempt to run xterm

Observed output:
Warnings to stderr with garbage characters, xterm displays in black on white

Expected behaviour:
No warnings on stderr, xterm displays prompt in colour.
Comment 2 Pinky 2006-06-06 06:28:50 UTC
The same for me

Portage 2.1_rc4-r2 (default-linux/x86/2005.1, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.16-ck11-K7 i686)
=================================================================
System uname: 2.6.16-ck11-K7 i686 AMD Sempron(tm)   2500+
Gentoo Base System version 1.12.1
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5-r2, 2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O0 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=athlon-xp -O0 -pipe -fomit-frame-pointer"
DISTDIR="/mnt/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict userpriv"
GENTOO_MIRRORS="http://ftp.sh.cvut.cz/MIRRORS/gentoo/gentoo http://ftp.linux.cz/pub/linux/gentoo "
LANG="cs_CZ.UTF-8"
LC_ALL="cs_CZ.UTF-8"
LINGUAS="en en_GB en_US cs"
MAKEOPTS="-j2"
PKGDIR="/root/work/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://ftp.sh.cvut.cz/gentoo-portage"
USE="x86 3dnow 3dnowext 7zip X X509 a52 aac ada afs aim alsa apache2 apm arts asf async audiofile avi bash-completion berkdb bidi bitmap-fonts bl blas bluetooth bookmarks bzip2 cairo canvas caps cdparanoia chroot clearcase cli crosscompile crypt cups curl cvs dba djbfft djvu doc dri dts dv dvb dvd dvdread dvi ecc eds emboss encode examples exif expat ffmpeg firefox flac foomaticdb fortran fpx freetype fuse gd gdbm gif gimp glep glitz glut gmp gnutls gphoto2 grammar graphviz gs gtk gtk2 gzip haskell hdf5 httpd iconv icq id3 idn imagemagick imlib imlib2 iproute2 ipv6 irc irda isdnlog jabber javascript jbig jpeg jpeg2k kde kqemu lame lcms libg++ libsamplerate libwww live lm_sensors logrotate lzo lzw-tiff mad mailwrapper math matroska md5sum mikmod mmap mmx mmxext mng mod modplug mp3 mp4 mp4live mpeg mpeg2 msn multicall musepack nas ncurses netboot network nls nntp no-old-linux no_wxgtk1 nodrm nptl nptlonly nsplugin objc ocaml ogg oggvorbis on-the-fly-crypt openal openexr opengl pam pam_chroot pascal pcre pda pdf pdflib perforce perl php pic player plotutils png ppds pppd python qt quicktime rdesktop readline real reflection rle rogue rss rtc ruby samba sametime scanner screen sdl serial session shout silc slang sms sndfile speex spell spl sql sqlite sse ssl stencil-buffer stream subversion svg swat t1lib tcltk test tetex theora thesaurus tiff truetype truetype-fonts type1-fonts unicode usb userlocales utf8 v4l v4l2 vcd vdr vhosts vim-pager vim-with-x vlm vorbis win32codecs wxwindows x264 xanim xatrix xine xml xml2 xorg xosd xpm xprint xscreensaver xv xvid yv12 zip zlib dvb_cards_dibusb-usb1 dvb_cards_dibusb-usb2 dvb_cards_or51132 dvb_cards_or51211 dvb_cards_ttpci dvb_cards_usb-a800 dvb_cards_usb-dtt200u dvb_cards_usb-umt dvb_cards_usb-vp702x dvb_cards_usb-vp7045 dvb_cards_usb-wt220u elibc_glibc input_devices_acecad input_devices_aiptek input_devices_calcomp input_devices_citron input_devices_digitaledge input_devices_dmc input_devices_dynapro input_devices_elo2300 input_devices_elographics input_devices_evdev input_devices_fpit input_devices_hyperpen input_devices_jamstudio input_devices_joystick input_devices_keyboard input_devices_magellan input_devices_magictouch input_devices_microtouch input_devices_mouse input_devices_mutouch input_devices_palmax input_devices_penmount input_devices_spaceorb input_devices_summa input_devices_synaptics input_devices_tek4957 input_devices_ur98 input_devices_vmmouse input_devices_void input_devices_wacom kernel_linux linguas_en linguas_en_GB linguas_en_US linguas_cs userland_GNU video_cards_apm video_cards_ark video_cards_ati video_cards_chips video_cards_cirrus video_cards_cyrix video_cards_dummy video_cards_-fglrx video_cards_glint video_cards_i128 video_cards_i740 video_cards_i810 video_cards_imstt video_cards_mach64 video_cards_mga video_cards_-newport video_cards_neomagic video_cards_nsc video_cards_nv video_cards_-nvidia video_cards_r128 video_cards_radeon video_cards_rendition video_cards_s3 video_cards_s3virge video_cards_savage video_cards_siliconmotion video_cards_sis video_cards_sisusb video_cards_tga video_cards_trident video_cards_tseng video_cards_v4l video_cards_vesa video_cards_vga video_cards_via video_cards_vmware"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Luca Barbato gentoo-dev 2006-06-06 06:36:35 UTC
CFLAGS="-march=athlon-xp -O0 -pipe -fomit-frame-pointer"
                         ^^^^

-O0 is one of the best way to get a broken system...
Comment 4 Pinky 2006-06-06 08:22:22 UTC
I do mistake in -O0 xterm wa build before with -Os !!!

with -O0 or with -O1, -O2 work well
Comment 5 Pinky 2006-06-06 08:22:32 UTC
I do mistake in -O0 xterm wa build before with -Os !!!

with -O0 or with -O1, -O2 work well
Comment 6 Pinky 2006-06-06 08:26:50 UTC
(In reply to comment #2)
> CFLAGS="-march=athlon-xp -O0 -pipe -fomit-frame-pointer"
>                          ^^^^
> 
> -O0 is one of the best way to get a broken system...
> 

Why? I expect till today that this is safe, because gcc does not optimize.
Comment 7 Jack Kelly 2006-06-06 19:13:18 UTC
I have just tried rebuilding xterm with -O0, -O1, -O2, -O3, -Os and it only shows this behaviour with -Os (although -Os works on GCC 3.4.6).
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2006-06-14 06:30:41 UTC
*** Bug 127346 has been marked as a duplicate of this bug. ***
Comment 9 Harald van Dijk (RETIRED) gentoo-dev 2006-07-12 23:44:20 UTC
Created attachment 91616 [details]
shortened example

The attached program displays the same bug (occurring in xterm's VTInitialize function): compiling with -O[0123] displays "0\n" x 256, but compiling with -Os displays a seemingly random -108 as well.
Comment 10 Harald van Dijk (RETIRED) gentoo-dev 2006-07-12 23:46:44 UTC
x 256 is too many, sorry, but that's not the point. Is this something to report to the GCC folks?
Comment 11 SpanKY gentoo-dev 2006-07-13 20:16:29 UTC
confirmed on x86 ... i'll try e-mailing the gcc lists
Comment 12 Brett Goulder 2006-08-27 06:32:51 UTC
Seems that with versions beyond 215 it also causes xterm to seg fault, I managed to fix it by merely doing replace-flags -Os -O2 in the ebuild here.
Comment 13 Harald van Dijk (RETIRED) gentoo-dev 2006-09-05 13:32:05 UTC
*** Bug 146442 has been marked as a duplicate of this bug. ***
Comment 14 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2006-09-10 21:08:44 UTC
Fixed this issue with a simple replace-flags command in the ebuild and made it an overlay. This could easily be made standard and pushed out but I guess if it could be fixed upstream that would be better.
Comment 15 Jack Kelly 2006-09-10 21:38:37 UTC
It will be fixed in 4.1.2, according to the GCC bugtracker, so is it worth it?
Comment 16 SpanKY gentoo-dev 2006-09-10 22:29:17 UTC
this will be in gcc-4.1.1-r2+
Comment 17 Harald van Dijk (RETIRED) gentoo-dev 2006-09-11 08:38:50 UTC
*** Bug 147163 has been marked as a duplicate of this bug. ***
Comment 18 SpanKY gentoo-dev 2006-09-14 00:28:32 UTC
*** Bug 142198 has been marked as a duplicate of this bug. ***
Comment 19 SpanKY gentoo-dev 2006-09-14 18:49:10 UTC
*** Bug 147401 has been marked as a duplicate of this bug. ***