Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28442 Discussions

Spurious segfault on deallocation with 14.0.2 compiler

Neil_Carlson
Beginner
310 Views

When compiled with the 14.0.2 compiler, the following test code segfaults on the clearly valid DEALLOCATE statement.  This code is a variation of the example I reported in https://software.intel.com/en-us/forums/topic/516602, and reproduces the error I was originally tracking down.   Some bad object code is being generated here.

program main

  type :: T1
    integer :: dim = 0
    class(*), allocatable :: bar
  end type

  type :: T2
    type(T1), allocatable :: foo
  end type
  
  type(T2) :: x
  
  allocate(x%foo)
  x%foo%dim = x%foo%dim + 1   ! NEEDED FOR THE SEGFAULT
  print *, 'Deallocating X%FOO ...'
  deallocate(x%foo)           ! <===  CODE SEGFAULTS ON THIS STATEMENT

end program

 

0 Kudos
2 Replies
Neil_Carlson
Beginner
310 Views

I forgot to add that the error goes away if either the components of T1 are swapped, or the assignment statement is removed.

0 Kudos
Kevin_D_Intel
Employee
310 Views

I confirmed the failure and the success with swapping the T1 components. The issue still exists in our newer release for later this year too. I reported the issue to Development (see internal tracking id below) and will keep you notified about a fix.

(Internal tracking id: DPD200357694)

0 Kudos
Reply