- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which version of ifort are you using? How did you compile this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page