I have a subroutine that is heavily used by a program I frequently run called UKKA_Dist_With_Max. I had benchmarked it using mandriva linux 2005LE. When I ran it using mandriva 2008.1, it ran much slower. Using the compiler from mandriva linux 2005LE (gcc-3.4.3) and mandriva 2008.1, I was able to reproduce the problem. For example, with gcc-3.4.3 a small run takes 191 seconds, but with gcc-4.2.3 the same run takes 247 seconds.
The switches I am using to compile, with both compilers are: -O3 -march=pentium4 -mtune=pentium4 -g -pthread \ -finline-functions -fschedule-insns2 -fbounds-check \ -W -Wall -pedantic -Wshadow -Wpointer-arith -Weffc++ \ -Wcast-qual -Wcast-align -Wwrite-strings -Wunused \ -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ -Woverloaded-virtual -Wsign-promo -Wunused-parameter \ -Wpointer-arith -Wreturn-type -Wcast-qual -Wswitch \ -Wshadow -Wcast-align \ -Wchar-subscripts -Winline -Wredundant-decls gcc-4.2.3 was prebuilt by mandriva with the following: Using built-in specs. Target: i586-manbo-linux-gnu Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --enable-languages=c,c++,ada,fortran,objc,obj-c++,java --host=i586-manbo-linux-gnu --with-cpu=generic --with-system-zlib --enable-threads=posix --enable-shared --enable-long-long --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo --disable-libjava-multilib --enable-ssp --disable-libssp Thread model: posix gcc version 4.2.3 (4.2.3-6mnb1) gcc-3.4.3 was built by me with the following: Reading specs from /home/jdeifik_2008.1/lib/gcc/i686-pc-linux-gnu/3.4.3/specs Configured with: ../gcc-3.4.3/configure --prefix=/home/jdeifik_2008.1 Thread model: posix gcc version 3.4.3 Here is the subroutine file, run through the preprocessor using gcc-4.2.3: -- Summary: gcc 4.2.3 produces poor code compared to gcc-3.4.3 on xeon prestonia Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jeff at jeffunit dot com GCC build triplet: i586-manbo-linux-gnu GCC host triplet: i586-manbo-linux-gnu GCC target triplet: i586-manbo-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36860