Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

allocatable arrays and intent(out)

807575Aug 22 2008 — edited Aug 27 2008
I found a strange behaviour, at least for me, of f95 compiler.
When a subroutine has an array as argument, declared intent(out), but without the allocatable argument (then "automatic array"), I can access to the values stored in the array, and modidy these values in the subroutine.
When the declaration in the subroutine is "allocatable" then the array is disallocated during the subroutine call and I have a segmentation fault when I try to access to the array's values.
According to what I found on the internet, the second behaviour looks OK : intent(out) make the variables undefined, and then disallocate the array.
Why is the array not undefined in the first case ?
Of course everything is fine with intent(inout) .... Which seems to me to be the correct syntax.
I've made a trial with a derived type instead of an array. with intent(out), the derived type is always undefined by the subroutine call.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2008
Added on Aug 22 2008
2 comments
892 views