Re: Derived Type Pointer Allocation Issue
- From: fj <francois.jacq@xxxxxxx>
- Date: Wed, 30 Apr 2008 14:26:51 -0700 (PDT)
On 30 avr, 23:05, Michael <mwpowel...@xxxxxxxxxxx> wrote:
Comp.lang.fortran Group Discussion
Hello,
I’m somewhat new to Fortran, so this is partly tutorial as well as
troubleshooting. Consider: we have a derived type looking something
like the following.
type grid
real(kind = rkind), pointer :: x(:)
real(kind = rkind), pointer :: y(:)
real(kind = rkind), pointer :: sigmaz(:)
real(kind = rkind), allocatable :: zg(:,:)
end type grid
We then declare a couple of variables using this as the type.
type (grid), allocatable, target, dimension(:) :: m_grid
type (grid), target :: c_grid
m_grid ends up being of a single dimension. On the other hand, c_grid
doesn’t appear to be allocated anywhere.
We pass the each grid through a couple of functions as a parameter
looking like the following,
type (grid), intent(out) :: grid_dat
After a couple of these function calls, we end up two calls deep in a
function with the following operation attempted,
allocate(grid_dat%x(idim), grid_dat%y(jdim), grid_dat
%sigmaz(kdim), grid_dat%zg(idim, jdim), stat = allocerr)
Now, the first time through, for m_grid, the call succeeds. We
allocate memory properly. The second time through, for c_grid,
however, the call fails. We consistently fail allocating memory for
grid_dat%zg.
The command line, where the application runs, has the following
information available:
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
ntdll.dll 7C911E58 Unknown Unknown Unknown
ntdll.dll 7C918251 Unknown Unknown Unknown
ntdll.dll 7C911C76 Unknown Unknown Unknown
lodi.exe 00737DF1 Unknown Unknown Unknown
I’ve done some research in regards to NTDLL.DLL, and this has
something to do with a critical section being initialized, or failing
to initialize. At any rate, I’m not really sure how to proceed from
here.
Options that I can think of might include, passing a pointer and not
the grid itself into these functions. That maybe there is some sort
of heap or stack issue.
Our environment is Microsoft Visual Studio 2005 running the Intel
Fortran Compiler (version 10 I think). We have linker options amped
up, plenty of heap and stack space made available, 200,000,000 in all.
We’ve tried increasing that, to no avail.
Any ideas? Thoughts? Suggestions? Many thanks in advance.
-Michael
Give us more information please, for instance the full source of the
function which allocates as well as the full source of the subroutine
which calls that function.
The number of bugs able to involve this kind of trouble is huge !
.
- Next by Date: Re: Pointers to derived type objects in COMMON
- Next by thread: Re: Derived Type Pointer Allocation Issue
- Index(es):
Relevant Pages
|