Corey Hickey wrote: > Ryan Hill wrote: >> On Mon, 28 Sep 2009 16:41:57 -0700 >> Corey Hickey <bugfood-ml@xxxxxxxxxx> wrote: >> >>> Hello, >>> >>> I'm running into a segfault with MPlayer on MKV files. I think it might >>> be a bug in some aspect of GCC 4.4's optimization, but I'm having >>> trouble narrowing it down. All I know for sure is: >>> >>> Works: >>> * compiled by gcc 4.4 with -O2 >>> * compiled by gcc 3.3, 3.4, 4.0, 4.1, 4.2, 4.3 (any optimization level) >>> * compiled by gcc svn trunk (any optimization level) >>> >>> Crashes: >>> * compiled by gcc 4.4 with -O3 >> We've seen the same problem and I think it was narrowed down to >> -finline-functions. See http://bugs.gentoo.org/269975. Unfortunately the >> rest of the bug report is just noise. Good luck! > > Thanks. I ran across that bug report several days ago but hadn't seen > the note about -finline-functions. > > Yet, I think my report has a bit more information, at least as it > pertains to the behavior I'm seeing: removing -finline-functions indeed > makes the segfault go away, but so does removing any one of these flags: > > -O1 > -fgcse > -finline-small-functions > -fschedule-insns2 > -fstrict-aliasing > -finline-functions > > All of the above have to be present to cause the crash to occur. > > Also of interest is that I can compile the rest of MPlayer without any > optimization (except for libswscale/swcale.c, which needs -O1 to > compile). I can then compile demux_mkv.c with the set of flags above to > cause the crash to occur. From within mplayer source tree: > > gcc-4.4 -g -I. -c -o libmpdemux/demux_mkv.o libmpdemux/demux_mkv.c -O1 > -fgcse -finline-small-functions -fschedule-insns2 -fstrict-aliasing > -finline-functions && make If a program compiles correctly with -fno-strict-aliasing and fails with -fno-strict-aliasing it almost certainly means that your program has an aliasing bug somewhere. gcc now has -Wstrict-aliasing, which will catch some but not all aliasing errors. Try it and see if you get any warnings. Andrew.