- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello!
The following program seems to reveal a compiler problem with finalized optional, allocatable polymorphic, intent(out) dummy arguments in a subprogram, which let the executable exit with a segfault on procedure entry(?).
[fortran]
module m
implicit none
! finalized derived type
type :: derived_type
contains
final :: finalizer
end type
contains
! derived type's final subroutine
subroutine finalizer(this)
type(derived_type), intent(inout) :: this
end subroutine
end module
program p
use m
implicit none
call do_something() ! runtime segfault
! forrtl: severe (174): SIGSEGV, segmentation fault occurred
contains
! a subprogram which returns finalized derived type
! important: intent(out), allocatable, optional
subroutine do_something(arg)
type(derived_type), intent(out), allocatable, optional :: arg
end subroutine
end program
[/fortran]
Note: As far as I checked it, the arguments attributes must not be changed (allocatable to pointer etc.) for the program to exhibit the reported behaviour.
Best regards
Ferdinand
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Which version of ifort are you using? How did you compile this?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Recent ifort (unix) version 14.0.1, no compiler flags:
$ ifort test.f90
$ ./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 000000000046AEF9 Unknown Unknown Unknown
a.out 0000000000469870 Unknown Unknown Unknown
a.out 0000000000438E72 Unknown Unknown Unknown
a.out 000000000041F273 Unknown Unknown Unknown
a.out 00000000004041AB Unknown Unknown Unknown
libpthread.so.0 00007F2C71C05CB0 Unknown Unknown Unknown
a.out 0000000000402CE4 Unknown Unknown Unknown
a.out 0000000000402C46 Unknown Unknown Unknown
libc.so.6 00007F2C7185776D Unknown Unknown Unknown
a.out 0000000000402B19 Unknown Unknown Unknown
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Assuming allocatable, optional and intent(out) ...without pointer...
are permitted together, the error (SIGSEGV) is doubly interesting since the final routine should only be called upon deallocate (implicit or explicit). The deallocate code should not have been generated.
Jim Dempsey