public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads
@ 2011-10-26 15:43 holyjoly at gmail dot com
  2011-10-26 15:54 ` [Bug fortran/50875] " xunxun1982 at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: holyjoly at gmail dot com @ 2011-10-26 15:43 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: holyjoly@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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
@ 2011-10-26 15:54 ` xunxun1982 at gmail dot com
  2011-10-26 16:08 ` holyjoly at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: xunxun1982 at gmail dot com @ 2011-10-26 15:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

xunxun <xunxun1982 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xunxun1982 at gmail dot com

--- Comment #1 from xunxun <xunxun1982 at gmail dot com> 2011-10-26 15:54:05 UTC ---
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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
  2011-10-26 15:54 ` [Bug fortran/50875] " xunxun1982 at gmail dot com
@ 2011-10-26 16:08 ` holyjoly at gmail dot com
  2011-10-26 16:35 ` xunxun1982 at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: holyjoly at gmail dot com @ 2011-10-26 16:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #2 from Joly Aarons <holyjoly at gmail dot com> 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
gcc version 4.5.4 (Ubuntu/Linaro 4.5.3-9ubuntu1) 
---------------------------------------------------------------------

Joly


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
  2011-10-26 15:54 ` [Bug fortran/50875] " xunxun1982 at gmail dot com
  2011-10-26 16:08 ` holyjoly at gmail dot com
@ 2011-10-26 16:35 ` xunxun1982 at gmail dot com
  2011-10-26 18:03 ` holyjoly at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: xunxun1982 at gmail dot com @ 2011-10-26 16:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #3 from xunxun <xunxun1982 at gmail dot com> 2011-10-26 16:35:38 UTC ---
The issue is related with "-mavx"

I use "gfortran -O3 -mavx" to reproduce the problem.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (2 preceding siblings ...)
  2011-10-26 16:35 ` xunxun1982 at gmail dot com
@ 2011-10-26 18:03 ` holyjoly at gmail dot com
  2011-10-26 18:10 ` holyjoly at gmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: holyjoly at gmail dot com @ 2011-10-26 18:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #4 from Joly Aarons <holyjoly at gmail dot com> 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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/50875] O3 and -march=native lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (3 preceding siblings ...)
  2011-10-26 18:03 ` holyjoly at gmail dot com
@ 2011-10-26 18:10 ` holyjoly at gmail dot com
  2011-10-26 22:53 ` [Bug target/50875] O3 and -mavx " ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: holyjoly at gmail dot com @ 2011-10-26 18:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #5 from Joly Aarons <holyjoly at gmail dot com> 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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/50875] O3 and -mavx lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (4 preceding siblings ...)
  2011-10-26 18:10 ` holyjoly at gmail dot com
@ 2011-10-26 22:53 ` ubizjak at gmail dot com
  2011-10-27 19:07 ` uros at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2011-10-26 22:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #6 from Uros Bizjak <ubizjak at gmail dot com> 2011-10-26 22:52:50 UTC ---
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}"


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/50875] O3 and -mavx lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (5 preceding siblings ...)
  2011-10-26 22:53 ` [Bug target/50875] O3 and -mavx " ubizjak at gmail dot com
@ 2011-10-27 19:07 ` uros at gcc dot gnu.org
  2011-10-27 21:55 ` uros at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2011-10-27 19:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #7 from uros at gcc dot gnu.org 2011-10-27 19:07:32 UTC ---
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/50875] O3 and -mavx lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (6 preceding siblings ...)
  2011-10-27 19:07 ` uros at gcc dot gnu.org
@ 2011-10-27 21:55 ` uros at gcc dot gnu.org
  2011-10-30 10:31 ` uros at gcc dot gnu.org
  2011-10-30 11:35 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2011-10-27 21:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #8 from uros at gcc dot gnu.org 2011-10-27 21:55:26 UTC ---
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/50875] O3 and -mavx lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (7 preceding siblings ...)
  2011-10-27 21:55 ` uros at gcc dot gnu.org
@ 2011-10-30 10:31 ` uros at gcc dot gnu.org
  2011-10-30 11:35 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2011-10-30 10:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

--- Comment #9 from uros at gcc dot gnu.org 2011-10-30 10:30:11 UTC ---
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/50875] O3 and -mavx lead to internal compiler error: in find_reloads
  2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
                   ` (8 preceding siblings ...)
  2011-10-30 10:31 ` uros at gcc dot gnu.org
@ 2011-10-30 11:35 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2011-10-30 11:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50875

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2011-10/msg02477.htm
                   |                            |l
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.4

--- Comment #10 from Uros Bizjak <ubizjak at gmail dot com> 2011-10-30 11:34:37 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-10-30 11:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-26 15:43 [Bug fortran/50875] New: O3 and -march=native lead to internal compiler error: in find_reloads holyjoly at gmail dot com
2011-10-26 15:54 ` [Bug fortran/50875] " xunxun1982 at gmail dot com
2011-10-26 16:08 ` holyjoly at gmail dot com
2011-10-26 16:35 ` xunxun1982 at gmail dot com
2011-10-26 18:03 ` holyjoly at gmail dot com
2011-10-26 18:10 ` holyjoly at gmail dot com
2011-10-26 22:53 ` [Bug target/50875] O3 and -mavx " ubizjak at gmail dot com
2011-10-27 19:07 ` uros at gcc dot gnu.org
2011-10-27 21:55 ` uros at gcc dot gnu.org
2011-10-30 10:31 ` uros at gcc dot gnu.org
2011-10-30 11:35 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).