- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I want to use the final bounding to clean a linked list, the simple example is:
[fortran]module TypeDef
implicit none
type A
integer :: id = -1
type(A), pointer :: next => null()
contains
final :: A_clean
end type A
contains
subroutine A_clean(this)
type(A), intent(inout) :: this
print *, "Clean element", this%id
if (associated(this%next)) deallocate(this%next)
end subroutine A_clean
end module TypeDef
program TBPFinal
use TypeDef
implicit none
type(A), pointer :: head
allocate(head)
head%id = 1
allocate(head%next)
head%next%id = 2
deallocate(head)
end program TBPFinal[/fortran] When I compile it with ifort 12, it complains:
ifort: error #10106: Fatal error in /opt/intel/composerxe-2011.0.085/bin/ia32/fortcom, terminated by segmentation violationcompilation aborted for TBPFinal.f90 (code 1)
Any idea? I also changed the attribute of "head" from "pointer" to "allocatable", since the document says:
A data entity is finalizable if it is of a finalizable type and is not a pointer.
dongli
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is a compiler bug. I will submit a bug report and keep you posted.
Thanks,
Xiaoping Duan
Intel Customer Support
Thanks,
Xiaoping Duan
Intel Customer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just encountered a similar problem when creating a linked list type - possibly the same. The reduced code is:
[fortran]MODULE err
IMPLICIT NONE
TYPE Object
TYPE(Object), POINTER :: next => NULL()
CONTAINS
FINAL :: Finalize_Object
END TYPE Object
CONTAINS
SUBROUTINE Finalize_Object(self)
TYPE(Object), INTENT(INOUT) :: self
DEALLOCATE(self%next)
END SUBROUTINE Finalize_Object
END MODULE err[/fortran] The error I obtained was nearly the same, but with a different platform and version:[plain]fort: error #10106: Fatal error in /opt/intel/composerxe-2011.1.107/bin/intel64/fortcom, terminated by segmentation violation compilation aborted for error.F90 (code 1)[/plain]
This error occurred when compiling the above on Fedora 14 x64 with ifort12.0.0 20101116 froml_fcompxe_intel64_2011.1.107. Hopefully this will help with the diagnosis!
Regards,
Jared Ahern
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both of the examples in this thread are resolved in Composer XE update #6 (aka 12.1 compiler). The packages containing the fixes are:
l_fcompxe_2011.6.233
m_fcompxe_2011.6.038
w_fcompxe_2011.6.233
The first example produces:
>ifort U79148.f90
Intel Visual Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.0.233 Build 2011081
-out:U79148.exe
>U79148.exe
Clean element 1
Clean element 2
Patrick Kennedy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It should be noted that your finalize routine could be potentially called explicitly, say to truncate your list at some point, therefor consider adding a nullify for the line pointer.
Jim Dempsey
Jim Dempsey
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page