我有一个 fortran 程序。子程序如下。程序在执行第 1434 行并打印以下内容后给出分段错误:
i: 115 256 2
Segmentation fault (core dumped)
参数为n1=258、n2=258、n3=258。NR=46480。为什么会发生分段错误?
75 double precision u(nr),v(nv),r(nr),a(0:3),c(0:3)
76 common /noautom/ u,v,r
......
196 call zero3(u,n1,n2,n3)
......
1418 subroutine zero3(z,n1,n2,n3)
1419
1420 c---------------------------------------------------------------------
1421 c---------------------------------------------------------------------
1422
1423 implicit none
1424
1425
1426 integer n1, n2, n3
1427 double precision z(n1,n2,n3)
1428 integer i1, i2, i3
1429
1430 !$omp parallel do default(shared) private(i1,i2,i3)
1431 do i3=1,n3
1432 do i2=1,n2
1433 do i1=1,n1
1434 print*,"i: ",i1, " ", i2 , " " ,i3
1435 z(i1,i2,i3)=0.0D0
1436 enddo
1437 enddo
1438 enddo
1439
1440 return
1441 end