I get the “Segmentation Error” error again and again when using my routines (I put them all in MODULE) with code written in a fixed form source (during fortran77 days).
The original make file (Linux platform) is a mess, it only compiles the source “.f”, so I had to change the extensions of my files from “.f90” to “.f” and left the first 7 columns empty in my modules. My modules make extensive use of whole massive operations and operations on array sections, and I declare F90-style variables, many of which are arrays of the estimated size.
My question is: although the compiler compiles these modules (with whole arrays / arrays) without any warnings / errors, it is a “segmentation error” due to the use of modules with whole arrays / arrays (stored in .f files) in outdated code ?
For example, I wrote the following code in the module "algorithm.f":
function dyad_vv(v1,v2) !dyadic product of two vectors real*8, dimension(:)::v1,v2 real*8, dimension(size(v1,1),size(v2,1))::dyad_vv integer i,j do i=1,size(v1,1) do j=1,size(v2,1) dyad_vv(i,j)=v1(i)*v2(j) end do end do end function !================================== function dot_mv(m,v) !dot product of a matrix and a vector real*8, dimension(:,:)::m real*8, dimension(:)::v real*8, dimension(size(m,1))::dot_mv integer i,j do i=1,size(m,1) dot_mv(i)=0.0000D0 do j=1,size(v,1) dot_mv(i)=dot_mv(i)+m(i,j)*v(j) end do end do end function !================================== function dot_vm(v,m) !dot product of a vector and a matrix real*8, dimension(:)::v real*8, dimension(:,:)::m real*8, dimension(size(m,2))::dot_vm integer i,j do i=1,size(m,2) dot_vm(i)=0.0000D0 do j=1,size(v,1) dot_vm(i)=dot_vm(i)+v(j)*m(j,i) end do end do end function