Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
12 Views

Finalization: segfault on optional intent(out) allocatable

The finalization of a non-present optional intent(out) allocatable dummy argument produces a segmentation fault at runtime when the following code is compiled with ifort 16.0.3. This is the same issue as reported some years ago in https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/494928 (topic closed) and faintly ressembles https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/327918 (pointer instead of allocatabe).
module m
    ! finalized t
    type :: t
    contains
        final :: tfinal
    end type
contains
    subroutine tfinal(a)
        type(t), intent(inout) :: a
    end subroutine

    ! pass optional t, finalized on entry
    subroutine pass(a)
        type(t), allocatable, intent(out), optional :: a
        print *, 'passed'
    end subroutine
end module

program p
    use m
    type(t), allocatable :: a

    call pass(a)        ! ok
    call pass()         ! segfault
end program
It would certainly be nice to have a fix for this, or some ideas for workarounds without having to change the dummy's attributes. Kind regards Ferdinand PS: Syntax-highlighting as suggested using (left-angle bracket) pre class="brush:fortran" (right-angle bracket) doesn't work in my post.
0 Kudos
1 Reply
Highlighted
12 Views

Thank you for reporting this problem. I have opened a bug report for it. The report ID is DPD200414190

 

Thanks,

Xiaoping Duan

Intel Customer Support

0 Kudos