Newsgroups: comp.lang.fortran
From: Gib Bogle <g.bo...@auckland.no.spam.ac.nz>
Date: Tue, 06 May 2008 16:01:28 +1200
Local: Tues, May 6 2008 12:01 am
Subject: Derived types and allocatable
I am still trying to get to grips with how one should copy derived types that contain allocatable
arrays. The test program below, when compiled with IVF 10.1, displays the cdata array contents correctly, but gives an access violation in the deallocation step. If I neglect the deallocation there are no error messages. When compiled on IBM Linux (with xlf95_r) it runs without errors. But running my real program, in which I am presumably doing something wrong, on the IBM machine there is no error until the deallocation step, which is carried out exactly as in the code below, and then I get a multitude of error messages like glibc detected *** double free or corruption (!prev): 0x100a0220 Is it OK to do cell2(i) = cell1(i) when cell2(i)%cdata has not been allocated, or do I first need to ensure that %cdata is allocated? !---------------------------------------------------------------- allocate(cell1(2)) do i = 1,2 do i = 1,2 do i = 1,2 end You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||