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

crash with calls through procedure pointers nested in arrays/allocatable derived types

joseph_battelle
Beginner
355 Views
I would appreciate it if Intel could try this code with update 7 or the end of year release and provide confirmation this bug is fixed.

While the code below compiles and runs fine as is, if you comment out the temporary pointer and uncomment the equivalent call through the array subscript selector the code will crash at the call site.

[fortran]module M14
    type B
        procedure(foo), pass, pointer :: f
    end type B
    type, extends (B) :: D
        integer :: i
    end type D
    type C
        class(B), pointer :: b
    end type C
    type F
        type(C) :: arena(5)
    end type F
contains
    subroutine foo (c, i)
    class(B), intent(inout) :: c
    integer, intent(in) :: i
        print *, 'ok: ', i
    end subroutine foo
    
    subroutine build
        type(F) :: v
        class(B), pointer :: p
        allocate (D:: v%arena(1)%b)
        p => v%arena(1)%b 
        p%f => foo !OK: if called through a temporary pointer
        !call v%arena(1)%b%f (1); calls through a subscript crash at runtime
        call p%f (1)
    end subroutine build
end module M14

program C14
    use M14
    call build
end program C14[/fortran]

0 Kudos
1 Solution
Steven_L_Intel1
Employee
355 Views
This problem is unrelated to the other post you mentioned. This program still fails - I will look into it further.

Escalated as DPD200157908.

View solution in original post

0 Kudos
4 Replies
Steven_L_Intel1
Employee
356 Views
This problem is unrelated to the other post you mentioned. This program still fails - I will look into it further.

Escalated as DPD200157908.
0 Kudos
joseph_battelle
Beginner
355 Views
Steve,
Thanks for your quick reply on this and the other defect report I generated over the weekend.
Joe
0 Kudos
Steven_L_Intel1
Employee
355 Views
This bug will be fixed in an update to the next major release. When I have more specifics, I will reply here.

Note - if you edit a post, it does not show as new so I did not see the question you added. I don't know when you did that.
0 Kudos
Steven_L_Intel1
Employee
355 Views
This was fixed in 12.0 Update 1.
0 Kudos
Reply