[Bug fortran/82996] ICE and segfault with derived type finalization
neil.n.carlson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 14 20:30:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82996
--- Comment #2 from neil.n.carlson at gmail dot com ---
In the final example I drop the elemental attribute from the FOO final
procedure and modify the BAR final procedure to loop over the elements of its B
array component. This too yields an ICE:
f951: internal compiler error: in generate_finalization_wrapper, at
fortran/class.c:1975
module mod
type foo
integer, pointer :: f(:) => null()
contains
final :: foo_destroy
end type
type bar
type(foo) :: b(2)
contains
final :: bar_destroy
end type
contains
subroutine foo_destroy(this)
type(foo), intent(inout) :: this
if (associated(this%f)) deallocate(this%f)
end subroutine
subroutine bar_destroy(this)
type(bar), intent(inout) :: this
integer :: j
do j = 1, size(this%b)
call foo_destroy(this%b(j))
end do
end subroutine
end module
program main
use mod
type(bar) :: x
call sub(x)
contains
subroutine sub(x)
type(bar), intent(out) :: x
end subroutine
end program
More information about the Gcc-bugs
mailing list