Calling a subroutine in Fortran (Segmentation fault)
问题 The following code gives segmentation error when compiled with pgf90 on the Linux system, while is run successfully when I used the Intel Visual FORTRAN on Windows. program main implicit none integer:: a(3), b(3) ,c(3) a=[3, 4, 5] b=[1, 2, 3] call sub(a,b,c) write(*,*)'a+b = ',c end program main subroutine sub(a,b,c) implicit none integer, intent(in)::a(:),b(:) integer, intent(out)::c(:) c=a+b end subroutine sub Any explanation for this ? 回答1: When you call a subroutine which has assumed