Andrewgaven
Technical User
Hello all
After running my program i get this error:
----------------------------------
*** glibc detected *** ./a.out: free(): invalid pointer: 0x080537f0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e1ea85]
.
.
.
======= Memory map: ========
08048000-0804c000 r-xp 00000000 08:02 3096578 /home/andrew/Escritorio/halo/a.out
0804c000-0804d000 rw-p 00004000 08:02 3096578 /home/andrew/Escritorio/halo/a.out
.
.
.
aborted
--------------------------
Does anyone know why this error occurs?, and how to fix it?
this is the code of my sub routine
-------------------------------
SUBROUTINE BACK(E,p,L,k,abc)
IMPLICIT NONE
INTEGER , INTENT(IN) :: p,k,L
INTEGER :: i,j,ja,jo,n,pun
REAL , INTENT(IN) :: E(p,k),abc(L*K*3)
REAL :: pal4(L*k,L*k*3),dx1,dx2,dx3,U(1,k+1)
U(1,k+1)=1.;
do j=1,p
U(1,=(/ (E(j,i),i=1,k) /)
do i=1,L*k; do jo=1,3*L*k; pal4(i,j)=0;enddo;enddo
n=1;jo=1;pun=1;i=1;
do
dx1=(2*abc(i+1)/(abc(i)**2))*exp(-(((E(j,jo) -abc(i+2))/abc(i))**(2*abc(i+1))))*(U(1,j)-abc(i+2))*&
((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1)-1);
if (E(j,jo) .NE. abc(i+2)) then
dx2=(-2*log(abs(E(j,jo)-abc(i+2))/abc(i))*exp( -(((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1))))*&
((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1)));
else
dx2=0;
endif
dx3=(2*abc(i+1)/abc(i))*exp(-(((E(j,jo) -abc(i+2))/abc(i))**(2*abc(i+1))))*&
((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1)-1);
pal4(n,i)=dx1
pal4(n,i+1)=dx2
pal4(n,i+2)=dx3
if (k == 1) then
pun=pun+1.;
n=pun+L*(jo-1.);
else
if (jo == k) then
jo=1;
n=pun+L*(jo-1.);
else
jo=jo+1.;n=pun+L*(jo-1.);pun=pun+1.;
endif
endif
if (i >= 3*L*k-2) then
exit
else
i=i+3.
endif
do ja=1,L*k
write (*,*) pal4(ja,
enddo
enddo
enddo
end subroutine
----------------------------
thank in advance.
After running my program i get this error:
----------------------------------
*** glibc detected *** ./a.out: free(): invalid pointer: 0x080537f0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e1ea85]
.
.
.
======= Memory map: ========
08048000-0804c000 r-xp 00000000 08:02 3096578 /home/andrew/Escritorio/halo/a.out
0804c000-0804d000 rw-p 00004000 08:02 3096578 /home/andrew/Escritorio/halo/a.out
.
.
.
aborted
--------------------------
Does anyone know why this error occurs?, and how to fix it?
this is the code of my sub routine
-------------------------------
SUBROUTINE BACK(E,p,L,k,abc)
IMPLICIT NONE
INTEGER , INTENT(IN) :: p,k,L
INTEGER :: i,j,ja,jo,n,pun
REAL , INTENT(IN) :: E(p,k),abc(L*K*3)
REAL :: pal4(L*k,L*k*3),dx1,dx2,dx3,U(1,k+1)
U(1,k+1)=1.;
do j=1,p
U(1,=(/ (E(j,i),i=1,k) /)
do i=1,L*k; do jo=1,3*L*k; pal4(i,j)=0;enddo;enddo
n=1;jo=1;pun=1;i=1;
do
dx1=(2*abc(i+1)/(abc(i)**2))*exp(-(((E(j,jo) -abc(i+2))/abc(i))**(2*abc(i+1))))*(U(1,j)-abc(i+2))*&
((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1)-1);
if (E(j,jo) .NE. abc(i+2)) then
dx2=(-2*log(abs(E(j,jo)-abc(i+2))/abc(i))*exp( -(((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1))))*&
((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1)));
else
dx2=0;
endif
dx3=(2*abc(i+1)/abc(i))*exp(-(((E(j,jo) -abc(i+2))/abc(i))**(2*abc(i+1))))*&
((E(j,jo)-abc(i+2))/abc(i))**(2*abc(i+1)-1);
pal4(n,i)=dx1
pal4(n,i+1)=dx2
pal4(n,i+2)=dx3
if (k == 1) then
pun=pun+1.;
n=pun+L*(jo-1.);
else
if (jo == k) then
jo=1;
n=pun+L*(jo-1.);
else
jo=jo+1.;n=pun+L*(jo-1.);pun=pun+1.;
endif
endif
if (i >= 3*L*k-2) then
exit
else
i=i+3.
endif
do ja=1,L*k
write (*,*) pal4(ja,
enddo
enddo
enddo
end subroutine
----------------------------
thank in advance.