主题:[讨论]Win32 Release/Win32 Debug两种模式运行问题
ghzpw
[专家分:30] 发布于 2010-11-09 14:11:00
我用Win32 Release 模式运行没有出现错误,但是用Win32 Debug模式运行,则出现数组越界,
运行终止,这是怎么回事?
5 楼
ghzpw [专家分:30] 发布于 2010-11-09 18:00:00
subroutine coo_A(AA,IAA,JAA)
include 'fpcom.txt'
dimension AA(*),IAA(*),JAA(*)
real*8 AA !存储矩阵A的非零元素
integer iaa !矩阵A非零元素的行指标
integer jaa !矩阵A非零元素的列指标
integer nnz !矩阵非零元素的个数
integer n1,n2,n3,n4,n5,n6,n7,n8,n9,npth
c
nnz=0
call mcoeff
do k=1,nrmax
do i=1,npmax
do j=1,nthmax
npth=(k-1)*npmax*nthmax
c
n1=npth+(i-1)*nthmax+j-nthmax-1
if(n1.gt.0.and.amp9(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp9(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n1
endif
c
n2=npth+(i-1)*nthmax+j-1
if(n2.gt.0.and.amp8(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp8(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n2
endif
c
n3=npth+(i-1)*nthmax+j+nthmax-1
if(n3.gt.0.and.amp7(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp7(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n3
endif
c
n4=npth+(i-1)*nthmax+j-nthmax
if(n4.gt.0.and.amp6(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp6(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n4
endif
c
n5=npth+(i-1)*nthmax+j
if(n5.gt.0.and.amp5(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp5(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n5
endif
c
n6=npth+(i-1)*nthmax+j+nthmax
if(n6.gt.0.and.amp4(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp4(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n6
endif
c
n7=npth+(i-1)*nthmax+j-nthmax+1
if(n7.gt.0.and.amp3(j,i,k).ne.0. )then
nnz=nnz+1
aa(nnz)=amp3(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n7
endif
c
n8=npth+(i-1)*nthmax+j+1
if(n8.gt.0.and.amp2(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amp2(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n8
endif
c
n9=npth+(i-1)*nthmax+j+nthmax+1
if(n9.gt.0.and.amp1(j,i,k).ne.0.) then
nnz=nnz+1
aa(nnz)=amp1(j,i,k)
iaa(nnz)=npth+(i-1)*nthmax+j
jaa(nnz)=n9
else
endif
c
if(k.gt.1.and.amr3(i,j,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amr3(j,i,k)
iaa(nnz)=(k-1)*npmax*nthmax+(i-1)*npmax+j
jaa(nnz)=(k-2)*npmax*nthmax+(i-1)*npmax+j
else
endif
c
if(k.lt.nrmax.and.amr1(j,i,k).ne.0.)then
nnz=nnz+1
aa(nnz)=amr1(j,i,k)
iaa(nnz)=(k-1)*npmax*nthmax+(i-1)*npmax+j
jaa(nnz)=k*npmax*nthmax+(i-1)*npmax+j
else
endif
print*,'k=',k,'i=',i,'j=',j
print*,'nnz_1=',nnz
c write(*,*)'aa(',nnz,')=',aa(nnz)
c write(*,*)'iaa(',nnz,')=',iaa(nnz)
c write(*,*)'jaa(',nnz,')=',jaa(nnz)
enddo
end do
end do
end
Win32 Release 模式:
k=10 i=51 j=51
nnz_1= 163981
win32 Debug 模式:
k=2,i=27 j=46
nnz_1=26030
forrt1; severe <161>:Program Exception - array bounds exeeded
其中:nrmax=10,npmax=51,nthmax=51