View previous topic :: View next topic |
Author |
Message |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Tue Apr 24, 2018 8:47 am Post subject: Associated() failing with 64 bit compiler |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Apr 24, 2018 9:50 am Post subject: |
|
|
Thanks. I have made a note that this needs fixing. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Apr 25, 2018 11:38 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue May 01, 2018 9:43 am Post subject: |
|
|
This has now been fixed for the next release of FTN95. |
|
Back to top |
|
|
|