14.0 Compiler generates incorrect results

14.0 Compiler generates incorrect results

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?]


	!! 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


	subroutine sub (p)

	type(foo), pointer :: 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

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Here's the example


Downloadapplication/octet-stream intel-bug-20131030.f90860 bytes

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)

I confirmed this defect is fixed in our next major release (15.0 compiler) due out later this year.

Leave a Comment

Please sign in to add a comment. Not a member? Join today