以下代码在 Linux 系统上使用 pgf90 编译时出现分段错误,而当我在 Windows 上使用 Intel Visual FORTRAN 时成功运行。
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
对此有何解释?