- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have attached a small program with relevant comments that demonstrate the issues. This happens with version 12.1 on opensuse 11.4. Here is a small summary of what I am seeing:
The following works in the main program, but it fails if I send vct to a subroutine and use the same allocate statement.
TYPE(Vector) :: vct
CLASS(*) :: v
ALLOCATE(v, SOURCE=vct)
DEALLOCATE(v)
However, it is possible to do
ALLOCATE(Vector::v)
SELECT TYPE (v)
TYPE IS (Vector)
v = vct
END SELECT
DEALLOCATE(v)
But, this causes a memory leak.
The following works in the main program, but it fails if I send vct to a subroutine and use the same allocate statement.
TYPE(Vector) :: vct
CLASS(*) :: v
ALLOCATE(v, SOURCE=vct)
DEALLOCATE(v)
However, it is possible to do
ALLOCATE(Vector::v)
SELECT TYPE (v)
TYPE IS (Vector)
v = vct
END SELECT
DEALLOCATE(v)
But, this causes a memory leak.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - we'll take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can see two problems.
First, in alloc_v, when v is deallocated, v%v is not being deallocated. Why this doesn't work here where it does in the main program I don't know. An explicit deallocate of v%v inside the select block is a workaround - but clearly this code isn't exactly representative of your application as the value of v is never used outside the routine.
The second problem in alloc_source_v is that the allocate with SOURCE= is not filling in v%v properly. Again, why this should fail when it worked in the main program, I don't know.
I didn't quite understand your comment about the "hang", but I am pretty sure that the above two issues are relevant.
Escalated as issue DPD200174103.
First, in alloc_v, when v is deallocated, v%v is not being deallocated. Why this doesn't work here where it does in the main program I don't know. An explicit deallocate of v%v inside the select block is a workaround - but clearly this code isn't exactly representative of your application as the value of v is never used outside the routine.
The second problem in alloc_source_v is that the allocate with SOURCE= is not filling in v%v properly. Again, why this should fail when it worked in the main program, I don't know.
I didn't quite understand your comment about the "hang", but I am pretty sure that the above two issues are relevant.
Escalated as issue DPD200174103.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both of the problems have been fixed. The first problem will be fixed in update 9. The second problem will be fixed in a future release.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page