Bug 50316 - ICE on fortran code with -O2 and -march=core2 options
Summary: ICE on fortran code with -O2 and -march=core2 options
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-07 10:07 UTC by ygepes
Modified: 2012-09-21 18:47 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
the offending source code (1.32 KB, text/plain)
2011-09-07 10:09 UTC, ygepes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ygepes 2011-09-07 10:07:26 UTC
C:\FORTRAN>gfortran -O2 -march=core2 -c -v bug.f
Using built-in specs.
Target: i586-pc-mingw32
Configured with: ../gcc-trunk/configure --prefix=/mingw --enable-languages=c,for
tran --with-gmp=/home/FX/gfortran/dependencies --disable-werror --enable-threads
 --disable-nls --build=i586-pc-mingw32 --enable-libgomp --disable-shared --disab
le-win32-registry --with-dwarf2 --disable-sjlj-exceptions
Thread model: win32
gcc version 4.5.0 20090421 (experimental) [trunk revision 146519] (GCC)
COLLECT_GCC_OPTIONS='-O2' '-march=core2' '-c' '-v'
 c:/f90/bin/../libexec/gcc/i586-pc-mingw32/4.5.0/f951.exe bug.f -ffixed-form -qu
iet -dumpbase bug.f -march=core2 -auxbase bug -O2 -version -fintrinsic-modules-p
ath c:/f90/bin/../lib/gcc/i586-pc-mingw32/4.5.0/finclude -o C:\DOCUME~1\gyr\LOCA
LS~1\Temp\ccm5jYrY.s
GNU Fortran (GCC) version 4.5.0 20090421 (experimental) [trunk revision 146519]
(i586-pc-mingw32)
        compiled by GNU C version 4.5.0 20090421 (experimental) [trunk revision
146519], GMP version 4.3, MPFR version 2.4.1-p5.
warning: GMP header version 4.3 differs from library version 4.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.5.0 20090421 (experimental) [trunk revision 146519]
(i586-pc-mingw32)
        compiled by GNU C version 4.5.0 20090421 (experimental) [trunk revision
146519], GMP version 4.3, MPFR version 2.4.1-p5.
warning: GMP header version 4.3 differs from library version 4.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
bug.f: In function 'sxdx':
bug.f:205: internal compiler error: in subst_stack_regs_pat, at reg-stack.c:1386

Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 ygepes 2011-09-07 10:09:03 UTC
Created attachment 25218 [details]
the offending source code
Comment 2 Dominique d'Humieres 2011-09-07 13:00:34 UTC
It looks like a duplicate of pr39856 fixed at revisions 147803/147804. You should update your gfortran 4.5.3 or better 4.6.1.
Comment 3 Tobias Burnus 2011-09-07 13:45:09 UTC
For obtaining a newer GCC/gfortran version, see also
  http://gcc.gnu.org/wiki/GFortranBinaries

It would be great if you could test a newer version and then report back whether your code is working.
Comment 4 ygepes 2011-09-09 08:18:11 UTC
Hi Tobias, I have upgraded to version 4.7.0 and the cse bug is gone. 
However, when I tried to compile shelxl (crystal structure refinement 
program) with this version, throwing the -O3 switch produced the 
following output below. The source file is large and not freeware, so I 
have not attached it. Pls tell me whether this is a known bug; if not, I 
can send the source later.

Many thanks, R. Gyepes


[r@HPBIOLABOR02 ...utils/shelxl]$ gfortran -v -O3 shelxl.for
Driving: gfortran -v -O3 shelxl.for -l gfortran
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/bin/../libexec/gcc/i686-pc-cygwin/4.7.0/lto-wrapper.exe

Target: i686-pc-cygwin
Configured with: ../trunk/configure --prefix=/usr/local/gfortran 
--enable-langua
ges=c,c++,fortran --enable-threads=posix --disable-sjlj-exceptions 
--enable-vers
ion-specific-runtime-libs --enable-nls --disable-libmudflap 
--disable-win32-regi
stry --with-system-zlib --disable-bootstrap --enable-werror 
--without-included-g
ettext --without-x --enable-libgomp --with-arch=i686 --with-tune=generic 
--disab
le-__cxa_atexit --enable-static --disable-shared --enable-shared-libgcc
Thread model: posix
gcc version 4.7.0 20110329 (experimental) [trunk revision 171562] (GCC)
COLLECT_GCC_OPTIONS='-v' '-O3' '-mtune=generic' '-march=i686'
  /usr/bin/../libexec/gcc/i686-pc-cygwin/4.7.0/f951.exe shelxl.for 
-ffixed-form -
quiet -dumpbase shelxl.for -mtune=generic -march=i686 -auxbase shelxl 
-O3 -versi
on -fintrinsic-modules-path 
/usr/bin/../lib/gcc/i686-pc-cygwin/4.7.0/finclude -o
  /tmp/ccLY6I7C.s
GNU Fortran (GCC) version 4.7.0 20110329 (experimental) [trunk revision 
171562]
(i686-pc-cygwin)
         compiled by GNU C version 4.3.4 20090804 (release) 1, GMP 
version 4.3.1,
  MPFR version 2.4.1-p5, MPC version 0.8
warning: GMP header version 4.3.1 differs from library version 4.3.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.7.0 20110329 (experimental) [trunk revision 
171562]
(i686-pc-cygwin)
         compiled by GNU C version 4.3.4 20090804 (release) 1, GMP 
version 4.3.1,
  MPFR version 2.4.1-p5, MPC version 0.8
warning: GMP header version 4.3.1 differs from library version 4.3.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
shelxl.for: In function 'sx3c':
shelxl.for:3682:0: error: insn does not satisfy its constraints:
(insn 6270 6269 5781 151 (set (reg/v/f:SI 14 st(6) [orig:3470 ff ] [3470])
         (mem/c:SI (plus:SI (reg/f:SI 7 sp)
                 (const_int 40 [0x28])) [0 S4 A32])) shelxl.for:3295 50 
{*movsi_i
nternal}
      (nil))
shelxl.for:3682:0: internal compiler error: in 
reload_cse_simplify_operands, at
postreload.c:403
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

On 7. 9. 2011 15:45, burnus at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50316
>
> Tobias Burnus<burnus at gcc dot gnu.org>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |burnus at gcc dot gnu.org
>
> --- Comment #3 from Tobias Burnus<burnus at gcc dot gnu.org>  2011-09-07 13:45:09 UTC ---
> For obtaining a newer GCC/gfortran version, see also
>    http://gcc.gnu.org/wiki/GFortranBinaries
>
> It would be great if you could test a newer version and then report back
> whether your code is working.
>
Comment 5 Uroš Bizjak 2011-09-09 09:58:51 UTC
(In reply to comment #4)
> Hi Tobias, I have upgraded to version 4.7.0 and the cse bug is gone. 
> However, when I tried to compile shelxl (crystal structure refinement 
> program) with this version, throwing the -O3 switch produced the 
> following output below. The source file is large and not freeware, so I 
> have not attached it. Pls tell me whether this is a known bug; if not, I 
> can send the source later.

> shelxl.for: In function 'sx3c':
> shelxl.for:3682:0: error: insn does not satisfy its constraints:
> (insn 6270 6269 5781 151 (set (reg/v/f:SI 14 st(6) [orig:3470 ff ] [3470])
>          (mem/c:SI (plus:SI (reg/f:SI 7 sp)
>                  (const_int 40 [0x28])) [0 S4 A32])) shelxl.for:3295 50 
> {*movsi_i
> nternal}
>       (nil))
> shelxl.for:3682:0: internal compiler error: in 
> reload_cse_simplify_operands, at
> postreload.c:403

It is not known bug, register allocator assigns x87 stack register to SImode (integer) move.  This bug can't be solved without (minimized) testcase.
Comment 6 Uroš Bizjak 2011-09-09 10:09:57 UTC
(In reply to comment #5)

> It is not known bug, register allocator assigns x87 stack register to SImode
> (integer) move.  This bug can't be solved without (minimized) testcase.

Please, also see [1] for bug reporting instructions.

[1] http://gcc.gnu.org/bugs/