Bug 113396 - -fforce-addr breaks mkvtoolnix 1.5.5, 1.6.0, 1.7.0
Bug#: 113396 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: media-video@gentoo.org Reported By: crusaderky@gmail.com
Component: Applications
URL: 
Summary: -fforce-addr breaks mkvtoolnix 1.5.5, 1.6.0, 1.7.0
Keywords:  
Status Whiteboard: 
Opened: 2005-11-23 14:19 0000
Description:   Opened: 2005-11-23 14:19 0000
All binaried in mkvtoolnix, both version 1.5.5 and 1.6.0, built with either
libmatroska 0.7.6 and 0.8.0, segfault on startup (with no arguments).

This is the backtrace for mmg-1.6.0 (using matroska 0.8.0):

#0  0xb7dee927 in uw_frame_state_for (context=0xbffcec28, fs=0xbffceb68) at
/var/tmp/portage/gcc-3.3.6/work/gcc-3.3.6/gcc/unwind-dw2.c:954
#1  0xb7deefb8 in _Unwind_RaiseException (exc=0x81f06b0) at unwind.inc:95
#2  0xb7eacd89 in __cxa_throw () from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/libstdc++.so.5
#3  0x080d1bc7 in
std::__uninitialized_copy_aux<__gnu_cxx::__normal_iterator<std::string*,
std::vector<std::string, std::allocator<std::string> > >,
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > > > ()
#4  0xb7f96cc0 in libmatroska::KaxChapterProcessData::ClassInfos () from
/usr/lib/libmatroska.so.0
(gdb) quit

I've compiled it with CFLAGS="-g -pipe" FEATURES="nostrip debug"


$ emerge info
Portage 2.0.51.22-r3 (default-linux/x86/2005.0, gcc-3.3.6, glibc-2.3.5-r2,
2.6.14-gentoo-r2 i686)
=================================================================
System uname: 2.6.14-gentoo-r2 i686 AMD Athlon(TM) XP 2000+
Gentoo Base System version 1.6.13
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -pipe -march=athlon-xp -fforce-addr -fomit-frame-pointer
-falign-functions=4 -mfpmath=sse"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/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/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -pipe -march=athlon-xp -fforce-addr -fomit-frame-pointer
-falign-functions=4 -mfpmath=sse"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig digest distcc distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.gg3.net/ ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO
http://gentoo.channelx.biz/ http://ftp.isu.edu.tw/pub/Linux/Gentoo
ftp://ftp.isu.edu.tw/pub/Linux/Gentoo"
LANG="it_IT@euro"
LINGUAS="it"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex X X509 a52 aac aaca52 aad adns alsa apache2 audiofile avi
berkdb bitmap-fonts bzip2 cdparanoia cdr chroot crypt cscope cups curl dga dts
dvb dvd dvdr dvdread emboss encode erandom ethereal exif expat fam fbcon ffmpeg
firefox flac flash foomaticdb fortran freetype gd gdbm ggi gif gimpprint ginac
glut gmp gnutls gpm gtk gtk2 guile hal idn imagemagick imap imlib innodb ipv6
jack java javascript jikes jpeg junit kerberos krb4 lcms ldap libcaca libg++
libwww live lzo mad matroska mcal md5sum memlimit mhash mikmod ming mmx mmxext
mng motif mozilla mozsvg mp3 mpeg mpi mysql ncurses network nls nptl nvidia odbc
offensive ogg oggvorbis opengl pam parse-clocks pcre pdflib perl pic plotutils
png ppds prelude python qhull qt quicktime readline real recode rtc samba
scanner sdl skey slang slp sndfile snmp socks5 speex spell sqlite sse ssl stream
svg tcltk tcpd tetex tga theora tiff truetype truetype-fonts type1-fonts udev
usb v4l v4l2 vcd vorbis win32codecs wmf wxwindows xine xml xml2 xosd xprint xv
xvid xvmc yaz zlib linguas_it userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS

------- Comment #1 From Guido Imperiale 2005-11-23 14:19:58 0000 -------
in case someone wondered, mplayer and xine work just fine instead.

------- Comment #2 From Guido Imperiale 2005-12-06 16:51:34 0000 -------
uh-oh... gotcha!
it's a HeisenBug or, to say it less romantically, a CFLAGS fragility :(

the previous backtrace is useless since I didn't notice that overriding CFLAGS
does not override CXXFLAGS, too, so the packages were compiled as normal.

I found a CXXFLAGS configuration where the bug does NOT appear and everything
works smoothly. There are the test conditions:

1)libmatroska-0.8.0 and libebml-0.7.6 compiled normally
(CXXFLAGS="-Os -pipe -march=athlon-xp -fforce-addr -fomit-frame-pointer
-falign-functions=4 -mfpmath=sse")
2)gcc-3.4.4-r1, glibc-2.3.5-r2
3)mkvtoolnix-1.6.0 compiled with the following CXXFLAGS:

DOESN'T WORK: -Os -pipe -march=athlon-xp -fforce-addr -fomit-frame-pointer
-falign-functions=4 -mfpmath=sse
WORKS:        -Os -fomit-frame-pointer -march=athlon-xp
WORKS:        -g

*yaaaawn* sleepy.... more tests tomorrow

------- Comment #3 From Diego E. 'Flameeyes' Pettenò 2005-12-08 04:54:36 0000 -------
Changing fpmath is known to break. That's your problem. 
 

------- Comment #4 From Guido Imperiale 2005-12-08 15:15:56 0000 -------
Since I've been using -mfpmath=sse for about two years and I've never had a
single problem until now, I think the best choice would be to filter it out for
this particular package.

------- Comment #5 From Guido Imperiale 2006-07-14 09:43:01 0000 -------
after so many months, the bug is still there. *sigh*
the actual culprit is not -mfpmath, but -fforce-addr. removing it fixes the
problem.

src_compile() {
    strip-flags -fforce-addr
    ...

------- Comment #6 From Diego E. 'Flameeyes' Pettenò 2006-07-14 09:56:57 0000 -------
strip-flags does not filter only -fforce-addr so make sure you actually use
filter-flag and check if it's -fforce-addr the problem or something else that
is stripped by strip-flags.

------- Comment #7 From Guido Imperiale 2006-07-14 10:10:24 0000 -------
Yes, you're right.

src_compile() {
    filter-flags -fforce-addr
    ...

fixes the problem, too.

------- Comment #8 From Matthias Schwarzott 2006-08-30 11:22:22 0000 -------
Added filtering this flag out of CFLAGS.