- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The following code prints out 10 as the size of the ALLOCATABLE array after the array is deallocated. Is this the correct behavior or a compiler bug? I am using the latest version of the Intel Fortran compiler.
Thanks for any clarification.
PROGRAM Main
IMPLICIT NONE
INTEGER,ALLOCATABLE :: iTestArray(:)
WRITE (*,*) SIZE(iTestArray)
ALLOCATE (iTestArray(10))
WRITE (*,*) SIZE(iTestArray)
DEALLOCATE (iTestArray)
WRITE (*,*) SIZE(iTestArray)
END
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's your error for calling SIZE on an unallocated array. The result of that is undefined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should use the function allocated(itestarray)
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