- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using ifort version 12.1.0 on an linux Ferdora 15 32b computer.
I having an segmentation fault error using allocatable derived-type with allocatable components when I am trying to extend the size of the allocatable derived-type using the move_alloc function.
I think the problem come from the fact that, using the move_alloc function, I am just allocating the overall derived-type structure and not the individual allocatable components.
Could someone please confirms that this is the origine of the error.
Assuming that it is, how can I performed a nested allocation of my derived-type structure ?
Does the "allocate(X, source=Y)" can be anny help ?
Thanks for helping.
I am using ifort version 12.1.0 on an linux Ferdora 15 32b computer.
I having an segmentation fault error using allocatable derived-type with allocatable components when I am trying to extend the size of the allocatable derived-type using the move_alloc function.
I think the problem come from the fact that, using the move_alloc function, I am just allocating the overall derived-type structure and not the individual allocatable components.
Could someone please confirms that this is the origine of the error.
Assuming that it is, how can I performed a nested allocation of my derived-type structure ?
Does the "allocate(X, source=Y)" can be anny help ?
Thanks for helping.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have not experimented with your situation and cannot comment as if you are seeing a bug or if you are attempting to do something not supported. You might try recoding along the line of:
allocate(temp(size(Array)+expandBy)
temp(1:size(Array)) = Array
call move_alloc(temp, Array)
*** the above assumes your user defined type has proper initialization ***
Jim Dempsey
I have not experimented with your situation and cannot comment as if you are seeing a bug or if you are attempting to do something not supported. You might try recoding along the line of:
allocate(temp(size(Array)+expandBy)
temp(1:size(Array)) = Array
call move_alloc(temp, Array)
*** the above assumes your user defined type has proper initialization ***
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
However, the problem is that , in your example, the "Array" variable is a allocatable derived-typed with allocatable component.
So the "allocate(temp(size(Array)+expandBy)" statement do not allocatae the componene tof the "Temp" derived-type structure.
When doing "temp(1:size(Array)) = Array" I do not know how does the allocatable component of "Array" (which have been allocated) are store in the un-allocataed component of "Temp".
However, the problem is that , in your example, the "Array" variable is a allocatable derived-typed with allocatable component.
So the "allocate(temp(size(Array)+expandBy)" statement do not allocatae the componene tof the "Temp" derived-type structure.
When doing "temp(1:size(Array)) = Array" I do not know how does the allocatable component of "Array" (which have been allocated) are store in the un-allocataed component of "Temp".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran 2003 has the ability to auto allocate (and/or reallocate)objects on the left hand side of an assignment
-assume:realloc_lhs (or -assume:norealloc_lhs to disable)
The method (with -assume:realloc_lhs) should work, although I haven't tried it with derived-type allocatable components.
Jim Dempsey
-assume:realloc_lhs (or -assume:norealloc_lhs to disable)
The method (with -assume:realloc_lhs) should work, although I haven't tried it with derived-type allocatable components.
Jim Dempsey
![](/skins/images/71A9511A625CE5D5D45FB59952A4AA71/responsive_peak/images/icon_anonymous_message.png)
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