glibc detected *** ./run.out: munmap_chunk(): invalid pointer:

glibc detected *** ./run.out: munmap_chunk(): invalid pointer:

i have a fortran program , where the subroutine looks like:

         subroutine coefficient(istart,lorbit,nrec,nsite,nmax,nn,cmat,dmat)
implicit none
integer:: i,j,k,q,orb,rcs,site,itr,sorbit,strstat,torbit
integer::nn,lorbit,nrec,istart,cnt,nsite,nmax
real(8):: pp,d11,d12,d22
! real(8),dimension(nmax,9)::h1,h2,h3
! integer,dimension(nsite,nn)::npos
real(8),dimension(:,:),allocatable::h1,h2,h3
integer,dimension(:,:),allocatable::npos
real(8),dimension(0:nn,9,9)::str
real(8),dimension(9):: cmat,dmat
real(8),dimension(9,9)::str1
real(8),dimension(nrec+1)::alpha
real(8),dimension(0:nrec+1)::beta
character(8)cdum1
character(40)cdum2
allocate(h1(nmax,lorbit),h2(nmax,lorbit),h3(nmax,lorbit))
allocate(npos(nsite,nn))
.
.
.
so on

when i am directly assigneing the value of h1,h2, h3 and npos, the code is working fine. but if I am trying to use dynamic allocation, its coming out with error:
*** glibc detected *** ./run.out: munmap_chunk(): invalid pointer: 0x400bc008 ***
======= Backtrace: =========
/lib/libc.so.6(cfree+0x1bb)[0x5f321b]
./run.out[0x806b93b]
./run.out[0x804bda6]
./run.out[0x804c8d3]
./run.out[0x8049bc1]
/lib/libc.so.6(__libc_start_main+0xe0)[0x59c390]
./run.out[0x8049ad1]
======= Memory map: ========
00567000-00582000 r-xp 00000000 08:07 4859005 /lib/ld-2.7.so
00582000-00583000 r-xp 0001a000 08:07 4859005 /lib/ld-2.7.so
00583000-00584000 rwxp 0001b000 08:07 4859005 /lib/ld-2.7.so
00586000-006d9000 r-xp 00000000 08:07 2457626 /lib/libc-2.7.so
006d9000-006db000 r-xp 00153000 08:07 2457626 /lib/libc-2.7.so
006db000-006dc000 rwxp 00155000 08:07 2457626 /lib/libc-2.7.so
006dc000-006df000 rwxp 006dc000 00:00 0
006e1000-00708000 r-xp 00000000 08:07 2457630 /lib/libm-2.7.so
00708000-00709000 r-xp 00026000 08:07 2457630 /lib/libm-2.7.so
00709000-0070a000 rwxp 00027000 08:07 2457630 /lib/libm-2.7.so
0070c000-0070f000 r-xp 00000000 08:07 2457627 /lib/libdl-2.7.so
0070f000-00710000 r-xp 00002000 08:07 2457627 /lib/libdl-2.7.so
00710000-00711000 rwxp 00003000 08:07 2457627 /lib/libdl-2.7.so
08048000-080c5000 r-xp 00000000 00:1c 11714571 /matsc/students/Rudra/Recursion/Real/run.out
080c5000-080ca000 rwxp 0007c000 00:1c 11714571 /matsc/students/Rudra/Recursion/Real/run.out
080ca000-080ce000 rwxp 080ca000 00:00 0
08e1b000-08e63000 rwxp 08e1b000 00:00 0
40000000-40001000 r-xp 40000000 00:00 0 [vdso]
40001000-40002000 rwxp 40001000 00:00 0
40021000-4002d000 r-xp 00000000 00:1c 23593507 /matsc/students/Rudra/gfortran/lib/libgcc_s.so.1
4002d000-4002e000 r-xp 0000b000 00:1c 23593507 /matsc/students/Rudra/gfortran/lib/libgcc_s.so.1
4002e000-4002f000 rwxp 0000c000 00:1c 23593507 /matsc/students/Rudra/gfortran/lib/libgcc_s.so.1
4002f000-40
102000 rwxp 4002f000 00:00 0
bf95f000-bf974000 rwxp bffea000 00:00 0 [stack]
forrtl: error (76): Abort trap signal
Image PC Routine Line Source
. 40000402 Unknown Unknown Unknown
libc.so.6 005B0F91 Unknown Unknown Unknown
libc.so.6 005E79EB Unknown Unknown Unknown
libc.so.6 005F321B Unknown Unknown Unknown
run.out 0806B93B Unknown Unknown Unknown
run.out 0804BDA6 Unknown Unknown Unknown
run.out 0804C8D3 Unknown Unknown Unknown
run.out 08049BC1 Unknown Unknown Unknown
libc.so.6 0059C390 Unknown Unknown Unknown
run.out 08049AD1 Unknown Unknown Unknown
./run.sh: line 58: 25230 Aborted ( ./run.out )
Calculation aborted....rerun!!

again if i dont modularize the program, it is working fine...so i first suspes=ct some problem in transfering nmax,nsite...but later verified that it is not so. i have also checked ulimit -s unlimited and
ifort -heap-arrays but didnt help either. any suggestion?

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

This suggests that some code earlier in the program corrupted the data structures used to keep track of allocatable memory. I suggest turning on -check bounds and also seeing if you can identify after which point in the program this error occurs. I don't see that stack is relevant to this error.

Steve - Intel Developer Support

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen