When compiling MPlayer 1.0pre5, an internal compiler error is generated. Normally the program is compiled using make, so below is just the single file that causes that error: michal@nowy:~/tmp/MPlayer-1.0pre5/libmpcodecs$ cc -v -save-temps -c -I../libvo -../../libvo -I/usr/X11/include -W -Wall -Wno-unused-parameter -O2 -march=athlon- -mtune=athlon-4 -g3 -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Iusr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6include -I. -Inative -I.. -I../libmpdemux -I../loader -I/usr/include/gtk-1.2 -I/sr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -D_GNU_SOURCE - vf_spp.o vf_spp.c Reading specs from /usr/lib/gcc/i486-slackware-linux/3.4.2/specs Configured with: ../gcc-3.4.2/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux Thread model: posix gcc version 3.4.2 /usr/libexec/gcc/i486-slackware-linux/3.4.2/cc1 -E -quiet -v -I../libvo -I../../libvo -I/usr/X11/include -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -I. -Inative -I.. -I../libmpdemux -I../loader -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -dD -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE vf_spp.c -march=athlon-4 -mtune=athlon-4 -W -Wall -Wno-unused-parameter -fworking-directory -O2 -o vf_spp.i ignoring nonexistent directory "/usr/lib/gcc/i486-slackware-linux/3.4.2/../../../../i486-slackware-linux/include" ignoring nonexistent directory "../../libvo" ignoring duplicate directory "/usr/X11R6/include" ignoring duplicate directory "/usr/include/gtk-1.2" ignoring duplicate directory "/usr/include/glib-1.2" ignoring duplicate directory "/usr/lib/glib/include" ignoring duplicate directory "/usr/X11R6/include" #include "..." search starts here: #include <...> search starts here: ../libvo /usr/X11/include /usr/include/gtk-1.2 /usr/include/glib-1.2 /usr/lib/glib/include . native .. ../libmpdemux ../loader /usr/local/include /usr/lib/gcc/i486-slackware-linux/3.4.2/include /usr/include End of search list. /usr/libexec/gcc/i486-slackware-linux/3.4.2/cc1 -fpreprocessed vf_spp.i -quiet-dumpbase vf_spp.c -march=athlon-4 -mtune=athlon-4 -auxbase-strip vf_spp.o -g3 -O2 -W -Wall -Wno-unused-parameter -version -o vf_spp.s GNU C version 3.4.2 (i486-slackware-linux) compiled by GNU C version 3.4.2. GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=31940 vf_spp.c: In function `softthresh_mmx': vf_spp.c:292: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. michal@nowy:~/tmp/MPlayer-1.0pre5/libmpcodecs$
Created attachment 7777 [details] Preprocessed source file that results in the error
Created attachment 7779 [details] reduced testcase (1535 bytes) This testcase is invalid and crashes 3.4 (both c and c++) and --enable-checking 4.0. Use "-g3" to reproduce.
Created attachment 7926 [details] Shorter (valid) testcase (282 bytes)
Neither of the reduced test cases causes any segfault on powerpc-linux for me with gcc 4.0.
I can reproduce this with 3.4.0 and I get the following backtrace: #0 0x0083b41e in _int_free () from /lib/tls/libc.so.6 #1 0x0083c72b in free () from /lib/tls/libc.so.6 #2 0x0808a3b2 in _cpp_pop_buffer (pfile=0x8b45960) at ../../gcc/cpplib.c:1960 #3 0x0808b26c in _cpp_get_fresh_line (pfile=0x8b371f8) at ../../gcc/cpplex.c:783 #4 0x0808bd0a in _cpp_lex_direct (pfile=0x8b371f8) at ../../gcc/cpplex.c:822 #5 0x0808c70c in _cpp_lex_token (pfile=0x8b371f8) at ../../gcc/cpplex.c:710 #6 0x0808d26c in cpp_get_token (pfile=0x8b371f8) at ../../gcc/cppmacro.c:1061 #7 0x08053b2d in c_lex_with_flags (value=0x8408b14, cpp_flags=0x0) at ../../gcc/c-lex.c:308 #8 0x08054087 in c_lex (value=0x2c622c61) at ../../gcc/c-lex.c:436 But with an slightly old 4.0.0 (two months old, 20041124), I cannot reproduce this with either of the reduced testcases.
Broke: : Search converges between 2003-09-08-trunk (#346) and 2003-09-09-trunk (#347). Fixed : Search converges between 2003-11-03-trunk (#394) and 2003-11-04-trunk (#395). Broke again: : Search converges between 2004-01-01-trunk (#437) and 2004-01-17-trunk (#438). Fixed again (on the mainline but not the 3.4 branch): : Search converges between 2004-05-05-trunk (#452) and 2004-05-08-trunk (#453).
I still see the failure on mainline on i686-pc-linux-gnu.
[echristo@dzur ~/tmp]$ /dzur/sourceware/builds-gcc/build-dzur/gcc/xgcc -B/dzur/sourceware/builds-gcc/build-dzur/gcc/ bug.c -c -save-temps -g3 *** glibc detected *** malloc(): memory corruption: 0x08ca4ba8 *** bug.c:5: internal compiler error: Aborted Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. will probably help a bit more.
As of today, I can reproduce the bug on mainline (testcase from comment #3) only with g++.
Ran it through valgrind to track down the memory errors and then started hunting. Testing a patch currently. valgrind returns no errors after patch. -eric
Subject: Bug 19077 CVSROOT: /cvs/gcc Module name: gcc Changes by: echristo@gcc.gnu.org 2005-02-15 23:18:04 Modified files: gcc/testsuite : ChangeLog libcpp : ChangeLog macro.c Added files: gcc/testsuite/gcc.dg/cpp: 20050215-1.c Log message: 2005-02-15 Eric Christopher <echristo@redhat.com> PR preprocessor/19077 * macro.c (cpp_macro_definition): Move handling of whitespace to PREV_WHITE conditional. Remove overloading of len variable. 2005-02-15 Eric Christopher <echristo@redhat.com> * gcc.dg/cpp/20050215-1.c: New file. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5038&r2=1.5039 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/20050215-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/ChangeLog.diff?cvsroot=gcc&r1=1.53&r2=1.54 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/macro.c.diff?cvsroot=gcc&r1=1.8&r2=1.9
Fixed.
Not fixed on the 3.4 branch.
I suppose I could apply the patch there too.
Subject: Bug 19077 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: echristo@gcc.gnu.org 2005-02-16 23:07:47 Modified files: gcc : ChangeLog cppmacro.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg/cpp: 20050215-1.c Log message: 2005-02-16 Eric Christopher <echristo@redhat.com> PR preprocessor/19077 * gcc.dg/cpp/20050215-1.c: New file. 2005-02-16 Eric Christopher <echristo@redhat.com> PR preprocessor/19077 * cppmacro.c (cpp_macro_definition): Move handling of whitespace to PREV_WHITE conditional. Remove overloading of len variable. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.800&r2=2.2326.2.801 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cppmacro.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.141.6.1&r2=1.141.6.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.362&r2=1.3389.2.363 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/20050215-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed