Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 227311 - gcc 4.3.1 incorrect compilation of xorg-server>=1.3.0.0-r6
Summary: gcc 4.3.1 incorrect compilation of xorg-server>=1.3.0.0-r6
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-15 20:16 UTC by Grégoire Favre
Modified: 2008-10-05 03:33 UTC (History)
4 users (show)

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


Attachments
Crude workaround for gcc loop optimization bug in xorg-server (gcc-bug-workaround.diff,822 bytes, patch)
2008-08-12 21:00 UTC, Christophe Saout
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Grégoire Favre 2008-06-15 20:16:05 UTC
I have the same problem using nv and nvidia driver, starting firefox/gkrellm/dillo just make X to quits :
Backtrace:
0: X(xf86SigHandler+0x6d) [0x49899d]
1: /lib/libc.so.6 [0x7f7f3fc73170]
2: X [0x439e36]
3: X(AddResource+0x101) [0x43a061]
4: X(ProcCreatePixmap+0x165) [0x44b9a5]
5: X(Dispatch+0x228) [0x4507a8]
6: X(main+0x495) [0x437f75]
7: /lib/libc.so.6(__libc_start_main+0xe6) [0x7f7f3fc5e486]
8: X(FontFileCompleteXLFD+0x251) [0x4371c9]
I have compiled severals xorg-server, from 1.3.0.0-r6 to 1.4.2 with gcc-4.3 and gcc-4.2.3 with agressive and only with -march=nocona -O2 -pipe all with same result...
Just adding the debug use flags and it works rock stable...

Reproducible: Always




Portage 2.1.5.5 (default/linux/amd64/2008.0, gcc-4.3.1, glibc-2.8_p20080602-r0, 2.6.25.6 x86_64)
=================================================================
System uname: 2.6.25.6 x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
Timestamp of tree: Sun, 15 Jun 2008 11:15:02 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r4
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.62
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.4
virtual/os-headers:  2.6.25-r4
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe -ftree-vectorize"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=core2 -O2 -pipe -ftree-vectorize"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.switch.ch/mirror/gentoo/ http://www.gigaload.org/gentoo.org/ ftp://mirror.switch.ch/mirror/gentoo/"
LANG="en_GB.UTF-8"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise /usr/portage/local/layman/berkano /usr/portage/local/layman/gechi /usr/portage/local/layman/arcon /usr/portage/local/layman/desktop-effects /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnowext 64bit 7zip X Xaw3d a52 aac aalib accessibility acl acpi aim aio alsa amd amd64 amr amrnb amrwb ansi aotuv apache2 apm async atm auctex audacious audiofile bash-completion berkdb bidi binary-drivers bl blas bonjour buffysize buttons bzip2 bzlib cairo caps cdda cddb cdio cdparanoia cdr chm chroot cli clisp console consolekit context corba cracklib crypt cryptoworks cscope css csv ctype cups curl curlwrappers cxx daap dar64 dga divx djbfft djvu doc dri dts dv dvb dvd dvdr dvdread dvi eac3 ecc encode exif expat extra fam fame fasttrack fat fbcon ffmpeg fftw firefox flac fltk fontconfig foomaticdb fortran fping fpx freetext g15 games gd gdal gdbm general ggi gif gimp gimpprint ginac glibc-omitfp glitz glut glx gmedia gmp gmtfull gmthigh gmtsuppl gmttria gnutella gnutls gopher gpgme gpm grammar graphics graphviz grass gs gstreamer gtalk gtk gtk2 gtkhtml guile h323 hardcoded-tables hdf5 howl-compat httpd humanities iconv icq id3 id3tag idn ieee1394 imagemagick imlib ipv6 irc isdnlog ithreads jabber jack jack-tmpfs java javascript jbig jikes jpeg jpeg2k kerberos kig-scripting kqemu lame laptop latex lcd lcms libcaca libedit libnotify libsamplerate libtommath libvisual libwww live lj lm_sensors lnbsharing logitech-mouse logrotate lzo lzw mad matroska mbox midi mikmod mime mimencode mjpeg mmx mmxext mng mod mono motif moznocompose moznoirc moznomail moznoroaming mozsvg mozxmlterm mp2 mp3 mp4 mp4live mpeg mpeg2 mplayer msn msnextras mudflap multilib musepack music mythtv nagra nautilus ncurses nethack netpbm network networking nfs nls nntp normalizemime nptl nptlonly nsplugin nvidia nvtv offensive ogg oggvorbis ole omega on-the-fly-crypt openexr opengl openmp openssl oscar pam pcre pda pdf perl player plotutils png posix pppd preview-latex pstricks publishers python pyzor qhull qt3 qt4 quicktime rar readline realmedia recode reflection regex reiser4 reiserfs rss rtc rtsp sasl science screen sdl seca session shl shout sid silc slang slp smime sms sndfile soundtouch sox speex spell spl srt sse sse-filters sse2 ssl stream subtitles svg svgz szip tcl tcltk tcpd tetex theora thesaurus threads threadsafe tiff tk tomsfastmath tools transcode truetype tv_check tv_combiner twolame type1 uk_bleb uk_rt unicode usb userlocales utf8 uudeview v4l v4l2 vamp vcd vcdimager vdr viaccess vim vim-pager vim-syntax vim-with-x vlm vorbis webdav wma wma123 wmf wmp wordperfect wv wxgtk1 wxwindows x264 xanim xattr xcb xetex xext xfs xine xinerama xinetd xml xml2 xorg xpm xv xvid xvmc yahoo zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="canon" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="g15" LINGUAS="en en_GB" USERLAND="GNU" VIDEO_CARDS="nv nvidia v4l"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Christophe Saout 2008-07-01 15:45:55 UTC
This bug still seems to exist in 1.4.99.902 and gcc 4.3.1 (on amd64).
It looks a little bit scary, I did some debugging in the xorg server code
and it seems that the hash table containing the X resources seems to get corrupted (the ->next pointer for chaining hash entries) and it crashes when resizing the hash table (which is a static method just below AddResource, where the crash is reported in the backtrace).

This is independent from the graphics driver and goes away when not compiling with -march=nocona. valgrind doesn't print anything before the failed read attempt. The ->next pointer is just a few bytes above the null pointer before the dereference fails.

The hash code itself looks foolproof, so I guess someone is writing over its bounds, possibly either due to a miscompilation or some optimization kicking in with -mnocona that is not expected (like the signed int wrapping assumption problem). I'll dig a bit further.
Comment 2 Robert Buchholz (RETIRED) gentoo-dev 2008-08-08 07:52:11 UTC
Christophe, did your further digging yield any results?
I could also reproduce this bug on 1.4*, i810, core2 and gcc-4.3.1
Comment 3 Christophe Saout 2008-08-08 09:49:11 UTC
No, not yet.  I will be on "vacation" (*) the next two weeks and this will be one of my projects to tackle. :-)

(*) not at work, but not at the beach either
Comment 4 Christophe Saout 2008-08-12 21:00:09 UTC
Created attachment 162781 [details, diff]
Crude workaround for gcc loop optimization bug in xorg-server
Comment 5 Christophe Saout 2008-08-12 21:00:31 UTC
Ok, I have nailed this down.  It is a pretty serious compiler screw-up.  A pretty simple loop initialising pointers seems to get screwed up by the tree vectorizer (every second entry having the wrong offset).
I'll attach an extremely crude workaound (not meant to be applied, it really just masks the ugly compiler bug) if someone wants to know what loop gets screwed up.  The workaround moves the loop into its own function which makes it not trigger the problem.
Let's see if the problem is serious enough to hold up 4.3.2 even further. ;-)
(will try to build a test case and report to gcc bugzilla)
Comment 6 Christophe Saout 2008-08-12 23:18:30 UTC
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37101
Comment 7 Donnie Berkholz (RETIRED) gentoo-dev 2008-08-13 06:36:30 UTC
Thanks for tracking this down, Christophe! Reassigning to the toolchain team since it's a gcc bug.
Comment 8 Christophe Saout 2008-08-14 12:43:34 UTC
The bug is fixed upstream:

http://gcc.gnu.org/viewcvs?view=rev&revision=139095
Comment 9 Mart Raudsepp gentoo-dev 2008-10-05 03:19:28 UTC
I upgraded gcc to 4.3.2 that became available in ~arch today, rebuilt xorg-server with -ftree-vectorize, restarted Xorg and it works fine now when compiled with gcc-4.3.2 and tree vectorizer (as expected, given the fix is included upstream in 4.3.2)
Comment 10 Mark Loeser (RETIRED) gentoo-dev 2008-10-05 03:33:01 UTC
(In reply to comment #9)
> I upgraded gcc to 4.3.2 that became available in ~arch today, rebuilt
> xorg-server with -ftree-vectorize, restarted Xorg and it works fine now when
> compiled with gcc-4.3.2 and tree vectorizer (as expected, given the fix is
> included upstream in 4.3.2)
> 

Thanks.  I'm not going to be backporting all of these fixes, so this is resolved now (by using the newest version)