- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Under certain circumstances, a pointer will remain associated, according to ASSOCIATED(), after it is deallocated. I've attached a 17-line example that exhibits this incorrect behavior with the new 14.0 compiler.
[Are we not allowed to attach files anymore?]
[fortran]
!!
!! COMPILER GENERATES INCORRECT CODE
!!
!! In the following example, a derived-type scalar pointer P is allocated and
!! then deallocated. At that point, ASSOCIATED(P) should return FALSE but it
!! returns TRUE. Key to the error seems to be that the pointer is a dummy
!! argument and that the derived type contains an allocatable CLASS(*) component.
!!
!! $ ifort --version
!! ifort (IFORT) 14.0.0 20130728
!!
!! $ ifort intel-bug-20131030.f90
!! $ ./a.out
!! associated(p) = T (should be FALSE)
!!
module foo_mod
type, public :: foo
class(*), allocatable :: value
end type
contains
subroutine sub (p)
type(foo), pointer :: p
allocate(p)
deallocate(p)
print *, 'associated(p) =', associated(p), '(should be FALSE)'
end subroutine
end module
program main
use foo_mod
type(foo), pointer :: p
call sub (p)
end program[/fortran]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reporting this issue and for the convenient reproducer. I reported it to Development (see internal tracking id below).
I found the previous 13.1 compiler produces the same result. If needed, as a work around, one can NULLIFY(p) explicitly after the deallocation.
(Internal tracking id: DPD200249493)
(Resolution Update on 09/16/2014): This defect is fixed in the Intel® Parallel Studio XE 2015 Initial Release (2015.0.090 - Linux)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I confirmed this defect is fixed in our next major release (15.0 compiler) due out later this year.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page