14.0.2 compiler bug: ALLOCATED returns the incorrect result

14.0.2 compiler bug: ALLOCATED returns the incorrect result

When the following test case is compiled with the 14.0.2 compiler, the executable returns T for the allocation status of  X%FOO when it is clearly not allocated.

program main

  type :: T1
    class(*), allocatable :: bar
  end type

  type :: T2
    type(T1), allocatable :: foo
  end type
  
  type(T2) :: x

  allocate(x%foo)
  deallocate(x%foo)
  print *, allocated(x%foo), ' (expect F)'  ! GIVES THE WRONG RESULT
  
end program

I've also attached the code for convenience.   The underlying cause of the problem may in fact be the same as for DPD200249493 which I reported last October.  The two examples are very similar but not identical.  I only recognized their similarities after spending several hours stripping a wad of actual code back to this example.  There was a workaround in that case, which involved nullifying a pointer;  is there a workaround in this case?  

AttachmentSize
Download intel-bug-20140618a.f90691 bytes
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The earlier issue (DPD200249493) is fixed in the release due out later this year; however, this new case is not affected by the fix for the earlier issue so they do not share the same root cause. I reported this new issue to Development (see internal tracking id below) and will let you know whether there is a work around.

(Internal tracking id: DPD200357693)

Login to leave a comment.