How to debug "Access not within mapped region" runtime error

Florian flad@gmx.at
Wed Aug 15 15:31:00 GMT 2007


Florian wrote:
> Jerry DeLisle wrote:
>> Florian wrote:
>>>
>>> I have a piece of code causing runtime troubles with gfortran 
>>> (compiling problems are solved thanks to your quick patchings). It 
>>> works with NAG, lahey, and intel fortran compiler, so I guess the 
>>> troubles are related with gfortran, that's why I would ask for advice 
>>> here how to debug the situation.
>>>


I could reduce my test case a lot now to show where the gdb seg fault 
comes from. I believe that this might be also the solution to the actual 
problem, though I am not sure yet.

This produces a seg fault in gdb when setting a breakpoint to 
chartestmod.f90:5 and trying to print startdate:


chartest.f90:
-----------------------------
program char_test

use chartestmod

implicit none

    INTEGER Request_Type
    CHARACTER (LEN = 19) :: StartDate

    StartDate='2003-03-15 00:00:00'

    CALL GeomSim(StartDate)

end
-----------------------------

chartestmod.f90:
-----------------------------
module chartestmod

contains

SUBROUTINE GeomSim(StartDate)

    CHARACTER (LEN=*), INTENT(IN) :: StartDate

     print*, startdate

end subroutine


end module
-----------------------------



Now, change in chartestmod.f90 'LEN=*' to 'LEN=19' and gdb does not 
segfault anymore. I somehow think that this is related to my actual 
problem, so: any ideas if this is related to a gfortran bug?

thanks, florian



More information about the Fortran mailing list