Created attachment 25618 [details] Stripped down test case. It appears that for certain combinations of array allocations, conditionals and loops, gfortran 4.6 and 4.7 give : "internal compiler error: in find_reloads, at reload.c:4067", but only when paired with -O3 and -march=native. Tried compiling against 4.6.1 and 4.7.0 20111010 (experimental) [trunk revision 179769]. It works against 4.4.6 and 4.5.4. I tried on two Sandy-Bridge systems, an i7 with Scientific Linux and an i5 with Ubuntu 11.10 and Mac OS X (Only tried 4.6 on this platform), which all gave the same behaviour. I have attached a completely stripped down test case (doesn't do anything meaningful) which works against 4.5 and 4.4 but not later versions for the described flags. The output of this when compiled against the earlier versions is: (-6.6689347635125245, -3.4315183934768561) (-0.21071909368227187,-0.21353560926074711) (-2.3118973846843422, -1.1895930430719770) (-3.7929436862808936,-3.8436409666934486). NB. spaces stripped out. For the moment, I am working around this by compiling the offending module with -O2, which works. Hope this helps, if you need any more information, please ask. Regards, Joly.
Your gcc -v information? And your cpu model? (I think it's related with cpu instruction set) I use i686-w64-mingw32 gfortran 4.6.2 to run the test well on Win7 intel core2.
(In reply to comment #1) > Your gcc -v information? > And your cpu model? (I think it's related with cpu instruction set) > > I use i686-w64-mingw32 gfortran 4.6.2 to run the test well on Win7 intel core2. Ok, cpuinfo: --------------------------------------------------------------------- joly@joly-laptop:~/src/castep_devel$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz stepping : 7 cpu MHz : 2301.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt xsave avx lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid bogomips : 4589.61 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: --------------------------------------------------------------------- and, gcc -v --------------------------------------------------------------------- Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) --------------------------------------------------------------------- When I run with 4.70, gcc -v is : --------------------------------------------------------------------- Using built-in specs. COLLECT_GCC=/usr/lib/gcc-snapshot/bin/gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.7.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 20111010-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,java,fortran,objc,obj-c++,go --prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id --with-system-zlib --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.7-snap/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.7-snap --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.7-snap --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.0 20111010 (experimental) [trunk revision 179769] (Ubuntu/Linaro 20111010-0ubuntu1) --------------------------------------------------------------------- And finally, a working version, gcc-4.5 -v : --------------------------------------------------------------------- Using built-in specs. COLLECT_GCC=gcc-4.5 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.5.4/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.3-9ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.5.4 (Ubuntu/Linaro 4.5.3-9ubuntu1) --------------------------------------------------------------------- Joly
The issue is related with "-mavx" I use "gfortran -O3 -mavx" to reproduce the problem.
Excellent, just for completeness, I can confirm that : gfortran -O3 -mavx does reproduce the problem identically and that : (In reply to comment #3) > The issue is related with "-mavx" > > I use "gfortran -O3 -mavx" to reproduce the problem.
Excellent, just for completeness, I can confirm that on my machines : gfortran -O3 -mavx does reproduce the problem identically and that : gfortran -O3 -mno-avx -march=native compiles successfully. Joly (In reply to comment #3) > The issue is related with "-mavx" > > I use "gfortran -O3 -mavx" to reproduce the problem.
Following (untested) patch fixes the failure for me: Index: sse.md =================================================================== --- sse.md (revision 180528) +++ sse.md (working copy) @@ -4231,12 +4231,11 @@ [(set (match_operand:V4DF 0 "register_operand" "=x,x") (vec_select:V4DF (vec_concat:V8DF - (match_operand:V4DF 1 "nonimmediate_operand" "xm,x") + (match_operand:V4DF 1 "nonimmediate_operand" " m,x") (match_operand:V4DF 2 "nonimmediate_operand" " 1,xm")) (parallel [(const_int 0) (const_int 4) (const_int 2) (const_int 6)])))] - "TARGET_AVX - && (!MEM_P (operands[1]) || rtx_equal_p (operands[1], operands[2]))" + "TARGET_AVX" "@ vmovddup\t{%1, %0|%0, %1} vunpcklpd\t{%2, %1, %0|%0, %1, %2}"
Author: uros Date: Thu Oct 27 19:07:27 2011 New Revision: 180576 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180576 Log: PR target/50875 * config/i386/sse.md (*avx2_unpcklpd256): Remove extra insn constraints. Change alternative 1 to "x,m,1". testsuitee/ChangeLog: PR target/50875 * gfortran.dg/pr50875.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/pr50875.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/sse.md trunk/gcc/testsuite/ChangeLog
Author: uros Date: Thu Oct 27 21:55:22 2011 New Revision: 180582 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180582 Log: PR target/50875 * config/i386/sse.md (*avx_unpcklpd256): Remove extra insn constraints. Change alternative 1 to "x,m,1". testsuitee/ChangeLog: PR target/50875 * gfortran.dg/pr50875.f90: New test. Added: branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/pr50875.f90 Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/i386/sse.md branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Author: uros Date: Sun Oct 30 10:30:06 2011 New Revision: 180676 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180676 Log: PR target/50875 * config/i386/sse.md (*avx_unpcklpd256): Remove extra insn constraints. Change alternative 1 to "x,m,1". testsuite/ChangeLog: PR target/50875 * gfortran.dg/pr50875.f90: New test. Added: branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/pr50875.f90 Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/config/i386/sse.md branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Fixed.