The code below causes gfortran to internal error when compiled as follows: gfortran -c Elements.F90 gfortran -c Global_Numbering.F90 In file Global_Numbering.F90:9
end module global_numbering 1 Internal Error at (1): find_array_spec(): Component not found This is similar to bug #18568 but differs in that this bug is only exhibited when the size is used in the dimension statement. Calling size in normal code does not cause the problem. I have compiled the test case from #18568 with the same compiler and no error resulted. The gfortran is compiled from SVN and has the following version string: > gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=c,c++,fortran : (reconfigured) ../gcc/configure Thread model: posix gcc version 4.2.0 20060519 (experimental) The code is as follows: module elements implicit none type element_type type(ele_numbering_type), pointer :: numbering end type element_type type ele_numbering_type integer, dimension(:,:), pointer :: number2count end type ele_numbering_type contains function element_local_coords(element) result (coords) type(element_type), intent(in) :: element ! The following line is the problem real, dimension(size(element%numbering%number2count, 1)) :: coords coords=0.0 end function element_local_coords end module elements module global_numbering use elements implicit none end module global_numbering -- Summary: Using size of array pointer component as dimension of function result causes gfortran internal error. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: David at ham dot dropbear dot id dot au GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27709