I have rewritten legacy code to use allocatable arrays
I am defining these in the Subroutine that calls the ode solver
DOUBLE PRECISION, dimension), ALLOCATABLE :: ATOL ,RTOL
DOUBLE PRECISION, dimension), ALLOCATABLE :: WORK
integer, DIMENSION), allocatable :: IWORK
allocate (RTOL(NEQ ), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate rtol in solve0U0'
stop 1
end if
allocate (ATOL(NEQ ), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate atol in solve0U0'
stop 1
end if
allocate (WORK(NRWRKRAD), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate WORK in solveOU0'
stop 1
end if
allocate (IWORK(NIWRKRAD), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate IWORK in solve0U0'
stop 1
end if
.......
22 CALL RADAU5( NEQ,FCN,T,Y,TOUT,H,
& RTOL,ATOL,ITOL,
& DJAC,
& IJAC,MLJAC,MUJAC, DUMMAS,
z IMAS,MLMAS,MUMAS,
c ok thus far
& SOLOUT,0,
z LDATIMES,NSUP,URESUR,URESUI,
& WORK,NRWRKRAD,
z IWORK,NIWRKRAD,RPAR,IPAR, IDID)
c radau5 has rtol, atol and work, iwork, dimensioned to their allocated dimensions
....................
deallocate (IWORK , stat=IALLOCATEstatus)
deallocate ( WORK , stat=IALLOCATEstatus)
deallocate (ATOL, stat=IALLOCATEstatus)
if(allocated(rtol)) deallocate (RTOL, stat=IALLOCATEstatus) !!! this is line 31134
I get an error (whether or not I check for allocated(rtol))
free(): invalid pointer
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0 0x7f99d22cad01 in ???
#1 0x7f99d22c9ed5 in ???
#2 0x7f99d1f9420f in ???
#3 0x7f99d1f9418b in ???
#4 0x7f99d1f73858 in ???
#5 0x7f99d1fde3ed in ???
#6 0x7f99d1fe647b in ???
#7 0x7f99d1fe7cab in ???
#8 0x55a74f9ee098 in stiffr_
at /home/me/DEVELOPMENT/HLINEARRADAUtst/ft185.f:31134
gdb complains about a missing raise.c file
free(): invalid pointer
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) l
45 in ../sysdeps/unix/sysv/linux/raise.c
Any ideas???
I am defining these in the Subroutine that calls the ode solver
DOUBLE PRECISION, dimension), ALLOCATABLE :: ATOL ,RTOL
DOUBLE PRECISION, dimension), ALLOCATABLE :: WORK
integer, DIMENSION), allocatable :: IWORK
allocate (RTOL(NEQ ), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate rtol in solve0U0'
stop 1
end if
allocate (ATOL(NEQ ), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate atol in solve0U0'
stop 1
end if
allocate (WORK(NRWRKRAD), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate WORK in solveOU0'
stop 1
end if
allocate (IWORK(NIWRKRAD), stat=iaLLOCATEstatus)
if (IALLOCATEstatUS /= 0) then
write(6,*)'ERROR trying to allocate IWORK in solve0U0'
stop 1
end if
.......
22 CALL RADAU5( NEQ,FCN,T,Y,TOUT,H,
& RTOL,ATOL,ITOL,
& DJAC,
& IJAC,MLJAC,MUJAC, DUMMAS,
z IMAS,MLMAS,MUMAS,
c ok thus far
& SOLOUT,0,
z LDATIMES,NSUP,URESUR,URESUI,
& WORK,NRWRKRAD,
z IWORK,NIWRKRAD,RPAR,IPAR, IDID)
c radau5 has rtol, atol and work, iwork, dimensioned to their allocated dimensions
....................
deallocate (IWORK , stat=IALLOCATEstatus)
deallocate ( WORK , stat=IALLOCATEstatus)
deallocate (ATOL, stat=IALLOCATEstatus)
if(allocated(rtol)) deallocate (RTOL, stat=IALLOCATEstatus) !!! this is line 31134
I get an error (whether or not I check for allocated(rtol))
free(): invalid pointer
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0 0x7f99d22cad01 in ???
#1 0x7f99d22c9ed5 in ???
#2 0x7f99d1f9420f in ???
#3 0x7f99d1f9418b in ???
#4 0x7f99d1f73858 in ???
#5 0x7f99d1fde3ed in ???
#6 0x7f99d1fe647b in ???
#7 0x7f99d1fe7cab in ???
#8 0x55a74f9ee098 in stiffr_
at /home/me/DEVELOPMENT/HLINEARRADAUtst/ft185.f:31134
gdb complains about a missing raise.c file
free(): invalid pointer
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) l
45 in ../sysdeps/unix/sysv/linux/raise.c
Any ideas???