When octave is build whith the "mpi" use flag set, it uses the mpicc compiler, which uses CFLAGS mpi was built with. In consequence octave is built with -ffast-math enabled and segfaults on an assertion in octave_main (NaN != -1). Reproducible: always Steps to reproduce: 1) CFLAGS="-ffast-math" emerge mpi 2) USE="mpi" emerge octave 3) run octave Solution: either enforce mpi to be built without -ffast-math or edit CFLAGS in /etc/mpi/mpichlib.conf emerge --info: Portage 2.1.1_pre2-r6 (default-linux/x86/2006.0, gcc-4.1.1/vanilla, glibc-2.4-r3 , 2.6.13.4 i686) ================================================================= System uname: 2.6.13.4 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz Gentoo Base System version 1.12.1 app-admin/eselect-compiler: 2.0.0_rc2-r1 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.60 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.17 sys-devel/gcc-config: 2.0.0_rc1 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=pentium4 -O2 -pipe " CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shu tdown /usr/share/X11/xkb /usr/share/config" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gcon f /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c" CXXFLAGS="-march=pentium4 -O2 -pipe " DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks metadata-transfer noclean parallel-fetch sandbox sfperms strict test" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/ distributions/gentoo" LINGUAS="pl en fr" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/d istfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X Xaw3d a52 aac acl acpi alsa ansi apache2 apm arts auctex audiofile av i berkdb bitmap-fonts blas bzip2 cairo cblas cdb cdparanoia cdr cli crypt cscope ctype cups curl dbus dga dlloader dri dv dvd dvdr dvdread eds emacs emboss enco de esd fdftk ffmpeg fftw firefox flac fltk foomaticdb fortran ftp gcj gdbm ggi g if gimpprint glitz gnome gnustep gnutls gphoto2 gpm graphviz gstreamer gtk gtk2 gtkhtml hal imagemagick imap imlib ipv6 isdnlog jack jpeg jpeg2k kde kdeenablefi nal kdehiddenvisibility ladcca lapack latex leim libg++ libwww lua mad maildir m ikmod mime mmap mmx mmxext mono motif mozilla mozsvg mp3 mpeg mpi mule ncurses n ls nodrm nptl nptlonly nsplugin nvidia objc ocaml octave ogg openal opengl oss p am patented pcre pdflib perl plotutils png posix ppds pppd python qt qt3 qt4 qui cktime readline reflection samba sdl session sndfile spell spl sse sse2 ssl svg szip tcl tcltk tcpd tetex theora threads tiff tk truetype truetype-fonts type1-f onts udev unicode vcd vorbis win32codecs wmf wxwindows xine xml xmms xorg xpm xp rint xv xvid zlib elibc_glibc input_devices_evdev input_devices_keyboard input_d evices_mouse kernel_linux linguas_pl linguas_en linguas_fr userland_GNU video_ca rds_nv video_cards_nvidia video_cards_vesa" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTA GE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Filter it out of your make.conf - very stupid global flag.