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 

Associated() failing with 64 bit compiler

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



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Tue Apr 24, 2018 8:47 am    Post subject: Associated() failing with 64 bit compiler Reply with quote

In the following code the associated() intrinsic incorrectly returns .TRUE. causing a run-time error when the deallocate statement is executed.

Since => null() initialisation is used the initial status of array subobject a is .not. associated. The code complies with the Standard.

This error occurs with the 64 bit compiler (irrespective of options used). The code works properly with the 32 bit compiler.

Code:

module global_array

   type wrap_t
      real, pointer :: a(:) => null()
   end type wrap_t
   
   type (wrap_t) :: wrapper(4)
   
contains

   subroutine tidy_up()
   
      integer :: i
     
      do i=1, 4
         if (associated(wrapper(i)%a)) then
            deallocate(wrapper(i)%a)
         end if
      end do
   
   end subroutine tidy_up
   
end module global_array

program test

   use global_array
   
   ! wrapper%a is not associated
   
   ! You get an error when tidy_up is called because associated function returns true
   ! Error is then generated at the deallocate statement
   call tidy_up()

end program test



This is the last of the issues with 8.3 I am aware of.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Apr 24, 2018 9:50 am    Post subject: Reply with quote

Thanks. I have made a note that this needs fixing.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Wed Apr 25, 2018 11:38 am    Post subject: Reply with quote

For me this only fails with /64 /UNDEF where the expected zero for the NULL is being incorrectly over-written by the "undefined" state.

So the temporary work-around is to avoid /UNDEF in this context.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Tue May 01, 2018 9:43 am    Post subject: Reply with quote

This has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
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