Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Deallocated pointers still have old shape specifications

$
0
0

I found it odd that deallocated pointers still have their shape information, even though "associated" returns .false. I suppose I expected to get an error, or at least zeroes. Is there a good reason for this behavior? Perhaps it makes sense but I can't see how.

program test_alloc
implicit none
integer, pointer :: perms(:,:)=>null()

print*,"associated",associated(perms)
print*,"shape",shape(perms)
allocate(perms(3,5))
print*,"associated",associated(perms)
print*,"shape",shape(perms)
deallocate(perms)
print*,"associated",associated(perms)
print*,"shape",shape(perms)
perms=>null()
print*,"associated",associated(perms)
print*,"shape",shape(perms)

end program test_alloc

 

 associated F
 shape           0           0
 associated T
 shape           3           5
 associated F
 shape           3           5
 associated F
 shape           3           5

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>