gfortran crashes when compiling teh attached code (the same segmentation fault occures when compiling with 4.2.0 version of gfortran) [trob@aqua] /tmp/gfortcrash $ gfortran -c kinds.f90 vamp_bundle.f90 vamp_bundle.f90:3166: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. [trob@aqua] /tmp/gfortcrash $ gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: /home/fxcoudert/gfortran_nightbuild/trunk/configure --prefix=/home/fxcoudert/gfortran_nightbuild/irun-20061130 --enable-languages=c,fortran --with-gmp=/home/fxcoudert/gfortran_nightbuild/software Thread model: posix gcc version 4.3.0 20061130 (experimental)
Created attachment 12754 [details] source files to crash gfortran unpack and execute gfortran -c kinds.f90 vamp_bundle.f90 to reproduce segmentation violation
Reduced testcase: module tao_random_numbers integer, dimension(10) :: s_buffer integer :: s_last = size (s_buffer) end module tao_random_numbers module linalg contains function diag (a) result (d) real, dimension(:,:), intent(in) :: a real, dimension(min(size(a,dim=1),size(a,dim=2))) :: d integer :: i do i = 1, min(size(a, dim = 1), size(a, dim = 2)) d(i) = a(i,i) end do end function diag end module linalg module vamp_rest use tao_random_numbers use linalg end module vamp_rest
Backtrace: 0x000000000043abf3 in mio_symtree_ref (stp=0xe2b070) at gcc/fortran/module.c:2199 2199 if ((*stp)->n.sym && check_unique_name((*stp)->name)) #1 0x000000000043b526 in mio_expr (ep=0xe2b028) at gcc/fortran/module.c:2637 Even more reduced test case. Note that changing the order of "use" suppresses the ICE. (ICE occurs with 4.1, 4.2, 4.3) module tao_random_numbers integer, dimension(10) :: s_buffer integer :: s_last = size (s_buffer) end module tao_random_numbers module linalg contains function diag (a) result (d) real, dimension(:), intent(in) :: a real, dimension(size(a)) :: d d = 0.0 end function diag end module linalg module vamp_rest use tao_random_numbers use linalg end module vamp_rest
(In reply to comment #3) It appears to be some wierdness with size => replace size with kind and the ICE goes away too. Paul
Note the patch was submitted 19/12 but the tracking system seems to have lost it. Paul
> Note the patch was submitted 19/12 but the tracking system seems to have lost > it. http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01326.html
Subject: Bug 30084 Author: pault Date: Fri Dec 22 20:49:00 2006 New Revision: 120155 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120155 Log: 2006-12-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/25818 * trans-array.c (gfc_trans_g77_array): If the variable is optional or not always present, make the statement conditional on presence of the argument. * gfortran.h : Add symbol_attribute not_always_present. * resolve.c (check_argument_lists): New function to check if arguments are not present in all entries. PR fortran/30084 * module.c (mio_component_ref): Move treatment of unique name variables, during output, to fix_mio_expr. (fix_mio_expr): New function that fixes defective expressions before they are written to the module file. (mio_expr): Call the new function. (resolve_entries): Call check_argument_lists. 2006-12-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/25818 * gfortran.dg/entry_array_specs_2.f: New test. PR fortran/30084 * gfortran.dg/nested_modules_6.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/entry_array_specs_2.f trunk/gcc/testsuite/gfortran.dg/nested_modules_6.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/module.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-array.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 30084 Author: pault Date: Wed Jan 3 21:27:17 2007 New Revision: 120399 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120399 Log: 2007-01-03 Paul Thomas <pault@gcc.gnu.org> Backport from trunk PR fortran/25818 * trans-array.c (gfc_trans_g77_array): If the variable is optional or not always present, make the statement conditional on presence of the argument. * gfortran.h : Add symbol_attribute not_always_present. * resolve.c (check_argument_lists): New function to check if arguments are not present in all entries. PR fortran/30084 * module.c (mio_component_ref): Move treatment of unique name variables, during output, to fix_mio_expr. (fix_mio_expr): New function that fixes defective expressions before they are written to the module file. (mio_expr): Call the new function. (resolve_entries): Call check_argument_lists. 2007-01-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/25818 * gfortran.dg/entry_array_specs_2.f: New test. PR fortran/30084 * gfortran.dg/nested_modules_6.f90: New test. Added: branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/entry_array_specs_2.f branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/nested_modules_6.f90 Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/gfortran.h branches/gcc-4_2-branch/gcc/fortran/module.c branches/gcc-4_2-branch/gcc/fortran/resolve.c branches/gcc-4_2-branch/gcc/fortran/trans-array.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Fixed on trunk and 4.2 Paul