runtime error

this is my program

program cpf
implicit none
integer n,m,b,k,D1,i,j,r,a,p,p1
complex, dimension(2,2) :: Y
real ,dimension(2,2) :: Yabs,angle
real ,dimension(D1,1) :: deltaAp,deltaAc
real, dimension(1,2) :: V,d
real, dimension(:,:) :: dia1
real v2,d2,Lm,it,g,pp0,qq0
v2=1.004
d2=0.013
Lm=0
it=0
g=1
n=2
m=0
D1=2*n-2-m+1
b=10
pp0=0.1
qq0=0
k=1
r=10
a=10
p=0
p1=0
Y(1,1)=(0,-10)
Y(1,2)=(0,10)
Y(2,1)=(0,10)
Y(2,2)=(0,-10)
Yabs=abs(Y)
angle=atan2(aimag(Y),real(Y))


do i=1,D1
deltaAp(i,1)=0
deltaAc(i,1)=1
end do

end program cpf

it is running successfully but after sometime a message comes
___.exe file has stopped working…

reason is 0xC0000374: A heap has been corrupted.

where the problem is??

The program is illegal and the compiler should have refused to produce an executable from it. The behavior of the resulting program is undefined.

Line 6 uses an uninitialized integer D1 as a dimension in an array declaration. An integer constant is acceptable here in a main program; an integer variable here, let alone one with no value specified, is not legal.

That the program ran for an appreciable length of time, given the insignificantly small amount of computing intended, is also a sign of a major bug in the program.