Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 80421 - Hang compiling openmotif-2.2.3
Summary: Hang compiling openmotif-2.2.3
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Heinrich Wendel (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-02 00:06 UTC by Ed Catmur
Modified: 2005-02-03 03:34 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Catmur 2005-02-02 00:06:10 UTC
GCC hangs while compiling openmotif-2.2.3

DataF.c: In function `df_ValidateString':
DataF.c:8653: warning: passing arg 1 of `mbtowc' from incompatible pointer type
DataF.c: In function `df_LoadGCs':
DataF.c:9009: warning: dereferencing type-punned pointer will break strict-aliasing rules
 i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I.. -I./.. -DXMBINDDIR_FALLBACK=\"/usr/lib/X11/bindings\" -DINCDIR=\"/usr/include/X11\" -DLIBDIR=\"/usr/lib/X11\" -I/usr/X11R6/include -O1 -O2 -O3 -pipe -march=athlon-xp -mmmx -msse -m3dnow -mfpmath=387 -ftracer -fomit-frame-pointer -falign-functions=64 -falign-loops=4 -falign-jumps=4 -funroll-loops -fprefetch-loop-arrays -Wall -Wno-unused -Wno-comment -Wp,-MD,.deps/DataF.pp -c DataF.c -o DataF.o >/dev/null 2>&1
make[2]: *** [DataF.lo] Error 1
make[1]: *** [all-recursive] Interrupt
make: *** [all-recursive] Interrupt

I hit Ctrl+C at this point.

Serious amounts of CPU used - 5+min with nothing to show.

Seems to work with empty CFLAGS, so perhaps stripping CFLAGS in the build might be an idea. I'll see if I can work out which CFLAGS are at fault here.
Comment 1 Ed Catmur 2005-02-02 00:24:56 UTC
Seems it's "-ftracer" that's the problem - remove that or -O3 and it compiles OK. Not surprising -ftracer chokes - it's one nasty source file.

Suggest that the ebuild filter-flags -ftracer.
Comment 2 Mihai Limbasan 2005-02-02 02:21:52 UTC
Works with -ftracer for me, gcc 3.4.3.20050110.
-march=athlon-xp -pipe -O2 -fno-ident -fomit-frame-pointer -momit-leaf-frame-pointer -fprefetch-loop-arrays -ftracer -ffast-math -frename-registers -fweb
Comment 3 Ed Catmur 2005-02-02 06:36:30 UTC
Sorry, should have been more clear: it's "-ftracer -O3" that's the problem.

Interesting: "-O -fforce-mem -fschedule-insns -funit-at-a-time" gives ICE:

$ gcc -I. -I/usr/X11R6/include -O -fforce-mem -fschedule-insns -funit-at-a-time  DataF.c
DataF.c: In function `df_ValidateString':
DataF.c:8653: warning: passing arg 1 of `mbtowc' from incompatible pointer type
DataF.c: In function `XmDataFieldSetHighlight':
DataF.c:12094: error: unable to find a register to spill in class `AREG'
DataF.c:12094: error: this is the insn:
(insn 72 64 73 1 (parallel [
            (set (reg:SI 1 dx [73])
                (ashiftrt:SI (reg:SI 74)
                    (const_int 31 [0x1f])))
            (clobber (reg:CC 17 flags))
        ]) 294 {ashrsi3_31} (insn_list:REG_DEP_ANTI 22 (insn_list:REG_DEP_OUTPUT 78 (insn_list 71 (nil))))
    (expr_list:REG_DEAD (reg:SI 74)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
DataF.c:12094: confused by earlier errors, bailing out

Unfortunately I can't get it any finer as -v -Q doesn't list the correct flags - compiling with the output of -v -Q replacing -O actually gives OK compile. It seems this is because gcc does NOT recognise -fsched-stalled-insns when passed on the command line; it only activates it when -O is given.

OK, this is the minimum I get that can cause a hang: "-O -funit-at-a-time -ftracer -finline-functions -fcse-follow-jumps -frerun-cse-after-loop" - again it is not possible to cut this down as -fshed-stalled-insns is not recognised.

$ gcc -I. -I/usr/X11R6/include -O -funit-at-a-time -ftracer -finline-functions -fcse-follow-jumps -frerun-cse-after-loop DataF.c
DataF.c: In function `df_ValidateString':
DataF.c:8653: warning: passing arg 1 of `mbtowc' from incompatible pointer type
<Ctrl+C> 

gcc version: 3.4.3.20050110

Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: /var/tmp/portage/gcc-3.4.3.20050110/work/gcc-3.4.3/configure --enable-version-specific-runtime-libs --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.3 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include/g++-v3 --host=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --enable-shared --enable-threads=posix --disable-multilib --disable-libgcj --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.3 20050110 (Gentoo Linux 3.4.3.20050110, ssp-3.4.3.20050110-0, pie-8.7.7)
Comment 4 Ed Catmur 2005-02-02 08:09:31 UTC
OK, -Q shows that the hang is while assembling df_ToggleAddMode:

Analyzing compilation unit
Performing intraprocedural optimizations
Assembling functions:
...
 df_ToggleAddMode <Ctrl+C>
Comment 5 Ed Catmur 2005-02-02 08:11:43 UTC
OK, this is fun. I created this mini testcase by paring down df_ToggleAddMode:

$ cat >foo.c <<<END
void set_it (char *s, int i, char v) {
    if (s[i] != v)
	s[i] = v;
}

int main (int argc, char **argv) {
    char *s = argv[0];
    int i = argc;
    set_it (s, i, !s[i]);
    if (s[i])
	return 1;
}
END
$ gcc -O -ftracer -finline-functions -fcse-follow-jumps -frerun-cse-after-loop foo.c
(hangs)

Definitely a gcc bug. I think the ICE is probably unrelated.
Comment 6 Ed Catmur 2005-02-02 08:12:37 UTC
Sorry, that should be

$ cat >foo.c <<END
void set_it (char *s, int i, char v) {
    if (s[i] != v)
	s[i] = v;
}

int main (int argc, char **argv) {
    char *s = argv[0];
    int i = argc;
    set_it (s, i, !s[i]);
    if (s[i])
	return 1;
}
END
$ gcc -O -ftracer -finline-functions -fcse-follow-jumps -frerun-cse-after-loop foo.c
(hangs)
Comment 7 Ed Catmur 2005-02-02 08:45:08 UTC
Even worse: this hangs:

int main (int argc, char **argv) {
    char v = **argv ? 0 : 1;
    if (**argv != v)
	**argv = 0;
    if (**argv)
	return 0;
}

(same CFLAGS)
Comment 8 Heinrich Wendel (RETIRED) gentoo-dev 2005-02-02 09:26:34 UTC
please post emerge info
Comment 9 Ed Catmur 2005-02-02 09:30:25 UTC
OK.

Portage 2.0.51-r15 (!/portage/make.profile, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-nitro4 i686)
=================================================================
System uname: 2.6.10-nitro4 i686 AMD Athlon(tm) XP 1700+
Gentoo Base System version 1.6.9
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Aug 25 2004, 02:26:58)]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.6.3, 1.5, 1.7.9-r1, 1.9.4, 1.8.5-r3, 1.4_p6
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O1 -O2 -O3 -pipe -march=athlon-xp -mmmx -msse -m3dnow -mfpmath=387 -falign-functions=64 -falign-loops=4 -falign-jumps=4 -fprefetch-loop-arrays -funswitch-loops -fprofile-use"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/NX/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/cursors/xorg-x11/default/ /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind /var/lib/games/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O1 -O2 -O3 -pipe -march=athlon-xp -mmmx -msse -m3dnow -mfpmath=387 -falign-functions=64 -falign-loops=4 -falign-jumps=4 -fprefetch-loop-arrays -funswitch-loops -fprofile-use"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache digest distcc distlocks fixpackages nostrip sandbox sfperms"
GENTOO_MIRRORS=" http://www.mirrorservice.org/sites/www.ibiblio.net/gentoo/ http://ftp.heanet.ie/pub/gentoo/ http://mirror.ac.uk/mirror/distro.ibiblio.org/pub/linux/distributions/gentoo/ http://ftp.gentoo.skynet.be/pub/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://gentoo.mirror.sdv.fr/ http://ftp.du.se/pub/os/gentoo/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo/ http://gentoo.oregonstate.edu/ http://www.ibiblio.org/pub/Linux/distributions/gentoo/ "
LANG="en_GB.iso88591"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/srv/gentoo/trees/main.breakmygentoo.net /srv/gentoo/trees/gnome-current.breakmygentoo.net /srv/gentoo/trees/lila-artwork /srv/gentoo/trees/kernel-sources /srv/gentoo/trees/bugs.gentoo.org /srv/gentoo/trees/gst-plugins.catmur.co.uk /srv/gentoo/trees/rmoss.jesus.ox.ac.uk /srv/gentoo/trees/capella.catmur.co.uk"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 3dfx 3dnow 3dnowex X aalib accessibility acl alsa apache2 apm artworkextra attr avi bash-completion berkdb bitmap-fonts bluetooth breakme bzip2 cdparanoia cdr cjk communication composite crypt cscope cups curl dbus design directfb divx4linux dmx dri dvd dvdr dvdread edl eds encode epiphany esd ethereal evo f77 faad fam fbcon ffmpeg flac flash font-server foomaticdb fortran freetype gaim gb gcl gdbm ggi gif gimpprint glitz glx gnome gnomedb gnutls gpm graphviz gstreamer gtk gtk2 gtkhtml guile hal howl imagemagick imap imlib imlib2 info input_devices_wacom ipv6 iso java javascript jpeg ldap libcaca libg++ libwww live lzo mad maildir man md5sum mdb mikmod mime mmx mmx2 mng mono mozdevelop mozilla mozsvg mpeg msoffice mysql nautilus ncurses network nls nocd nptl nptlonly nvidia oav offensive oggvorbis openal opengl openssh opi oss pam pda pdflib perl plotutils png postgres ppds productivity python quicktime readline real rtc ruby samba sasl sdl skippy-xd slang socks5 speex spell sse ssl svg svga tcltk tcpd tetex theora tiff truetype truetype-fonts type1-fonts unicode usb videos vim-with-x wmf wxwin wxwindows xanim xchattext xface xfs xml xml2 xprint xv xvid zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LC_ALL, LDFLAGS
Comment 10 Heinrich Wendel (RETIRED) gentoo-dev 2005-02-02 09:44:46 UTC
Your CFLAGS are broken, -O3 implies -O1 and -O2, so please remove them
Comment 11 Ed Catmur 2005-02-02 09:49:41 UTC
Those are not the CFLAGS that break openmotif.

The minimal CFLAGS to break openmotif are "-O -funit-at-a-time -ftracer -finline-functions -fcse-follow-jumps -frerun-cse-after-loop"
or alternatively "-O3 -ftracer"
Comment 12 Ed Catmur 2005-02-02 10:38:44 UTC
I've checked the gcc bugzilla for similar bugs and couldn't find anything so I've upstreamed the testcase in comment 7 to:
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19767

wrt openmotif, I think filtering out -ftracer is probably the best bet, as it seems to be needed to exhibit the bug in openmotif when other CFLAGS are sensible.
Comment 13 Claes Mogren 2005-02-02 13:35:15 UTC
Thanks for the tip about removing -ftracer. Compiled with no problems after that.
Comment 14 Heinrich Wendel (RETIRED) gentoo-dev 2005-02-02 14:19:55 UTC
-ftracer is now filtered
Comment 15 Mihai Limbasan 2005-02-02 21:58:54 UTC
Confirmed, I *can* get it to hang, but only with -finline-functions -ftracer. Strangely enough, either of them separately works.
Comment 16 Ed Catmur 2005-02-03 03:34:29 UTC
Fixed, thanks.

Note that this is a workaround for the underlying gcc bug (see above).