I use gcc version GNU Fortran 95 (GCC 4.0.0 20041019 (experimental)) to compile the enclosed source file with the options /home/eschnett/gcc/bin/gfortran -ftrapv -march=pentium4 -malign-double -g3 -c -o /home/eschnett/Calpha/Cactus/configs/einstein-gcc-debug/build/EHFinder/EHFinder_ReadData.F90.o /home/eschnett/Calpha/Cactus/configs/einstein-gcc-debug/build/EHFinder/EHFinder_ReadData.f90 and I find that gfortran seems to enter an infinite loop. Memory usage is reasonable, but after more than 17 minutes on a Pentium M 1200 MHz gfortran was not yet finished. Note that there is no optimisation, and that the source code is straightforward, except for lengthy argument lists.
Created attachment 7386 [details] failing source code
Confirmed. Reduced testcase: ===================================== subroutine FOO ( X ) character(len=*), intent(IN) :: X character(len=len(X)) :: C1, C2 C1 = '' C2 = '' end subroutine =====================================
For some reason c1 and c2 are chained together in an infinite list.
=================== subroutine FOO ( X ) character(len=*), intent(IN) :: X character(len=len(X)) :: C1 character(len=len(X)) :: C2 ! two lines C1 = '' C2 = '' end subroutine =================== doesn't show the problem, so this is a problem in how we share the lengths of different automatic length character entities. (the character lengths of objects declared on the same line are shared, unless assumed length)
*** Bug 20821 has been marked as a duplicate of this bug. ***
I encountered this same problem today, directly with an integer as parameter for the subroutine: subroutine FOO(N) integer, intent(IN) :: N character(len=N) :: C1, C2 C1 = '' C2 = '' end subroutine
For some reason we get an infinite linked list.
*** Bug 23798 has been marked as a duplicate of this bug. ***
Subject: Bug 18082 CVSROOT: /cvs/gcc Module name: gcc Changes by: pault@gcc.gnu.org 2005-10-12 20:29:22 Modified files: gcc/fortran : decl.c ChangeLog gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: automatic_char_len_1.f90 Log message: 2005-10-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/18082 * decl.c (variable_decl): Make a new copy of the character length for each variable, when the expression is not a constant. 2005-10-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/18082 gfortran.dg/automatic_char_len_1.f90: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/decl.c.diff?cvsroot=gcc&r1=1.41&r2=1.42 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.583&r2=1.584 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/automatic_char_len_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6180&r2=1.6181
*** Bug 24339 has been marked as a duplicate of this bug. ***
Subject: Bug 18082 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: pault@gcc.gnu.org 2005-10-14 04:53:30 Modified files: gcc/fortran : symbol.c trans-types.c decl.c ChangeLog gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: automatic_char_len_1.f90 save_common.f90 save_result.f90 derived_pointer_recursion.f90 Log message: 2005-10-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/20847 PR fortran/20856 * symbol.c (check_conflict): Prevent common variables and function results from having the SAVE attribute,as required by the standard. PR fortran/24092 * trans-types.c (gfc_get_derived_type): Insert code to obtain backend declaration for derived types, building if necessary. Return the derived type if the fields have been built by this process. Otherwise, continue as before but using the already obtained backend_decls for the derived type components. Change the gcc_assert to act on the field. PR fortran/18082 * decl.c (variable_decl): Make a new copy of the character length for each variable, when the expression is not a constant. 2005-10-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/18082 * gfortran.dg/automatic_char_len_1.f90: New test. PR fortran/20847 * gfortran.dg/save_common.f90: New test. PR fortran/20856 * gfortran.dg/save_result.f90: New test. PR fortran/24092 * gfortran.dg/derived_pointer_recursion.f90: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/symbol.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.26.2.5&r2=1.26.2.6 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-types.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.37.10.7&r2=1.37.10.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.31.2.4&r2=1.31.2.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.128&r2=1.335.2.129 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/automatic_char_len_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/save_common.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/save_result.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/derived_pointer_recursion.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.453&r2=1.5084.2.454
Fixed on mainline and teh 4.0 branch.