Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Derived Type Po...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 17 Topic 8194 of 8528
Post > Topic >>

Derived Type Pointer Allocation Issue

by Michael <mwpowellnm@[EMAIL PROTECTED] > Apr 30, 2008 at 02:05 PM

Comp.lang.fortran Group Discussion

Hello,

I=92m 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 =3D rkind), pointer :: x(:)
      real(kind =3D rkind), pointer :: y(:)
      real(kind =3D rkind), pointer :: sigmaz(:)
      real(kind =3D 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=92t 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 =3D 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=92ve 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=92m 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=92ve tried increasing that, to no avail.

Any ideas? Thoughts? Suggestions? Many thanks in advance.

-Michael
 




 17 Posts in Topic:
Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-04-30 14:05:06 
Re: Derived Type Pointer Allocation Issue
fj <francois.jacq@[EMA  2008-04-30 14:26:51 
Re: Derived Type Pointer Allocation Issue
Dick Hendrickson <dick  2008-04-30 21:40:38 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-04-30 15:46:10 
Re: Derived Type Pointer Allocation Issue
nospam@[EMAIL PROTECTED]   2008-04-30 16:19:00 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-04-30 16:25:12 
Re: Derived Type Pointer Allocation Issue
nospam@[EMAIL PROTECTED]   2008-04-30 16:38:24 
Re: Derived Type Pointer Allocation Issue
Steve Lionel <steve.li  2008-05-01 00:48:02 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-04-30 16:27:59 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-04-30 16:47:01 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-05-01 08:15:12 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-05-01 08:28:04 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-05-01 09:03:30 
Re: Derived Type Pointer Allocation Issue
Steve Lionel <steve.li  2008-05-04 01:05:45 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-05-01 12:48:23 
Re: Derived Type Pointer Allocation Issue
Dick Hendrickson <dick  2008-05-01 20:10:24 
Re: Derived Type Pointer Allocation Issue
Michael <mwpowellnm@[E  2008-05-01 14:08:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 18 20:37:26 CDT 2008.