The code snippet below compiles on FCFLAGS="-O1" and FCFLAGS="-O2", but gives an ICE on FCFLAGS="-O1 -fschedule-insns". The additional option is supposed to be part of -O2, according to [1]. The problem seems to be target-related as I could not reproduce it on i686-pc-linux-gnu. Code is reduced, but probably not minimal yet. $> cat ice.f90 MODULE class_dummy_atom_kdtree_types TYPE dummy_atom_kdtree_data INTEGER :: dummy END TYPE TYPE :: dummy_atom_kdtree_node TYPE(dummy_atom_kdtree_node_private), POINTER :: p END TYPE TYPE :: dummy_atom_kdtree_node_private TYPE(dummy_atom_kdtree_data) :: data END TYPE TYPE :: dummy_atom_kdtree TYPE(dummy_atom_kdtree_node) :: root END TYPE END MODULE FUNCTION dummy_atom_kdtree_insert(this, item) USE class_dummy_atom_kdtree_types, ONLY: dummy_atom_kdtree, dummy_atom_kdtree_node, dummy_atom_kdtree_data TYPE(dummy_atom_kdtree), INTENT(inout) :: this TYPE(dummy_atom_kdtree_data), INTENT(in) :: item TYPE(dummy_atom_kdtree_data) :: dummy_atom_kdtree_insert TYPE(dummy_atom_kdtree_node) :: parent, current TYPE(dummy_atom_kdtree_node) :: node INTEGER :: cmp, level, discriminator parent = dummy_atom_kdtree_node(null()) current = this%root level = 1 discriminator = 1 DO WHILE (ASSOCIATED( current%p )) discriminator = MODULO(level-1, 3) + 1 cmp = dummy_atom_kdtree_data_compare(item, current%p%data, discriminator) level = level + 1 END DO dummy_atom_kdtree_insert = item END FUNCTION $> gfortran-svn -O1 -fschedule-insns ice.f90 ice.f90: In function 'dummy_atom_kdtree_insert': ice.f90:42: error: unable to find a register to spill in class 'AREG' ice.f90:42: error: this is the insn: (insn 19 31 20 4 ice.f90:37 (parallel [ (set (reg:SI 37 r8 [69]) (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (reg:SI 37 r8 [68])) (zero_extend:DI (reg:SI 42 r13 [78]))) (const_int 32 [0x20])))) (clobber (scratch:SI)) (clobber (reg:CC 17 flags)) ]) 342 {*umulsi3_highpart_insn} (expr_list:REG_DEAD (reg:SI 37 r8 [68]) (expr_list:REG_UNUSED (reg:CC 17 flags) (nil)))) ice.f90:42: internal compiler error: in spill_failure, at reload1.c:1995 Please submit a full bug report, $> gfortran-svn -v gcc version 4.4.0 20080629 (experimental) (GCC) The same holds for 4.3.2. [1] http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options
No -fschedule-insns is not included for x86 because of register pressure. See PR 27001 also. There are many others due to the RA being dumb.
Confirmed, goes back at least to 4.2 (so not a regression).
Is this failure still triggered with recent mainline after http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00094.html ?
Can someone please fix fortran in the testcase, so it will compile with gcc 4.8?
> Can someone please fix fortran in the testcase, so it will compile with gcc > 4.8? The mailer has split a line in two: USE class_dummy_atom_kdtree_types, ONLY: dummy_atom_kdtree, dummy_atom_kdtree_node, dummy_atom_kdtree_data You can unsplit them, or replace them with (adding a & at the end of the first line) USE class_dummy_atom_kdtree_types, ONLY: dummy_atom_kdtree, & dummy_atom_kdtree_node, dummy_atom_kdtree_data I get the ICE with 4.4.6, but the code compiles with 4.5.3, 4.6.3, 4.7.1, and trunk and '-O1 -fschedule-insns'.
(In reply to comment #5) > I get the ICE with 4.4.6, but the code compiles with 4.5.3, 4.6.3, 4.7.1, and > trunk and '-O1 -fschedule-insns'. I propose we put the testcase in the testsuite (with -O1 -fschedule-insns for x86) and close the bug. Dominique, can you perhaps prepare the test in a correct way for the testsuite?
> Dominique, can you perhaps prepare the test in a correct way for the testsuite? I have tested a slightly reduced version ! { dg-do compile } ! { dg-options "-O1 -fschedule-insns" } MODULE class_dummy_atom_kdtree_types TYPE dummy_atom_kdtree_data INTEGER :: dummy END TYPE TYPE :: dummy_atom_kdtree_node TYPE(dummy_atom_kdtree_node_private), POINTER :: p END TYPE TYPE :: dummy_atom_kdtree_node_private TYPE(dummy_atom_kdtree_data) :: data END TYPE TYPE :: dummy_atom_kdtree TYPE(dummy_atom_kdtree_node) :: root END TYPE END MODULE FUNCTION dummy_atom_kdtree_insert(this, item) USE class_dummy_atom_kdtree_types TYPE(dummy_atom_kdtree), INTENT(inout) :: this TYPE(dummy_atom_kdtree_data), INTENT(in) :: item TYPE(dummy_atom_kdtree_node) :: parent, current INTEGER :: cmp, level, discriminator parent = dummy_atom_kdtree_node(null()) current = this%root level = 1 discriminator = 1 DO WHILE (ASSOCIATED( current%p )) discriminator = MODULO(level-1, 3) + 1 cmp = dummy_atom_kdtree_data_compare(item, current%p%data, discriminator) level = level + 1 END DO END FUNCTION What is the magic to avoid the -O in "-O -O1 -fschedule-insns"? For the record the original test and the reduced one compiles on powerpc-apple-darwin9 also with 4.3.0 and 4.4.6.
(In reply to comment #7) > What is the magic to avoid the -O in "-O -O1 -fschedule-insns"? You can't. This is how currently gfortran testsuite works. The part that should eventually be fixed is in lib/gfortran.exp: # look if this is dg-do-run test, in which case # we cycle through the option list, otherwise we don't if [expr [search_for $test "dg-do run"]] { set option_list $torture_with_loops } else { set option_list [list { -O } ] }
Author: uros Date: Sun Sep 2 08:10:21 2012 New Revision: 190855 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190855 Log: PR target/36680 * gfortran.dg/pr36680.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/pr36680.f90 Modified: trunk/gcc/testsuite/ChangeLog
Closed as fixed in 4.8.0.