[Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads

2011-10-26 Thread holyjoly at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

 Bug #: 50875
   Summary: O3 and -march=native lead to internal compiler error:
in find_reloads
Classification: Unclassified
   Product: gcc
   Version: 4.6.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: holyj...@gmail.com


Created attachment 25618
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25618
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.


[Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads

2011-10-26 Thread holyjoly at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #2 from Joly Aarons  2011-10-26 16:08:14 
UTC ---
(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
gc

[Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads

2011-10-26 Thread holyjoly at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #4 from Joly Aarons  2011-10-26 17:30:32 
UTC ---
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.


[Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads

2011-10-26 Thread holyjoly at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #5 from Joly Aarons  2011-10-26 17:35:29 
UTC ---
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.