forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SIZE does not return 0 after DEALLOCATE

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
simon



Joined: 05 Jul 2006
Posts: 144

PostPosted: Mon Apr 21, 2008 12:49 pm    Post subject: SIZE does not return 0 after DEALLOCATE Reply with quote

Why does the following program not indicate siez=0 in the third row of output? (The smiley face in line 3, seems to be an error, the code is written as ( : ) without the spaces.)

PROGRAM p
IMPLICIT NONE
INTEGER, DIMENSION(Smile, ALLOCATABLE :: i
INTEGER :: ios
!
WRITE (UNIT=*,FMT=*) ALLOCATED(i),SIZE(i)
ALLOCATE (i(5),STAT=ios)
WRITE (UNIT=*,FMT=*) ALLOCATED(i),SIZE(i)
DEALLOCATE (i)
WRITE (UNIT=*,FMT=*) ALLOCATED(i),SIZE(i)
!
END PROGRAM p
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4777
Location: Salford, UK

PostPosted: Mon Apr 21, 2008 5:18 pm    Post subject: Reply with quote

The Fortran 95 Standard says that SIZE must not be used when the array has not be allocated. So this is essentially a programming error that is difficult for FTN95 to trap.

When I tested with /checkmate the result was zero but you may not be able depend on this.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group