- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
the 15.0.1 ifort compiler produces errors on the following snippets. Are these errors still present in 15.0.2 ?
If someone can give advice, this would help me to decide whether I have to check / change all such "sourced allocation assignments" or just wait for our IT to upgrade the compiler.
Snippet 1:
- Sourced allocation into polymorphic array
- Source is allocated function result
program p implicit none type :: t logical :: is_not_empty ! seg. fault without end type class(t), dimension(:), allocatable :: a allocate(a, source=make_alloc()) print *, allocated(a) ! T print *, size(a) ! 0 (wrong) contains function make_alloc() result(a) type(t), dimension(:), allocatable :: a allocate(a(5)) print *, size(a) ! 5 end function end program
Snippet 2:
- Derived type t has polymorphic component
- Sourced allocation into array of type(t) fails
program p implicit none type :: s logical :: is_not_empty end type type :: t ! CLASS is the problem here class(s), allocatable :: polymorphic_component end type type(t), dimension(:), allocatable :: a allocate(a, source=make_alloc()) print *, allocated(a) ! T print *, size(a) ! 0 (wrong) contains function make_alloc() result(a) type(t), dimension(:), allocatable :: a allocate(a(1)) end function end program
Snippet 3:
- Similar to snippet 2 but errorneous code is executed in subroutine
- Runtime-error (different, though probably related to snippet 2)
module m type :: s logical :: is_not_empty end type type :: t class(s), allocatable :: polymorphic_component end type contains subroutine main() implicit none type(t), dimension(:), allocatable :: a allocate(a, source=make_alloc()) print *, allocated(a) ! T print *, size(a) ! 0 (wrong) end subroutine function make_alloc() result(a) type(t), dimension(:), allocatable :: a allocate(a(1)) end function end module program p use m implicit none call main() ! forrtl: severe (153): allocatable array or pointer is not allocated end program
An other question to Intel: On the new free-software page, for students / researchers (=me) non-commercial licenses are not offered for Fortran any more. How can I test features and report bugs in the latest compiler? (here, IT departments usually don't have the very latest version, for stability and maintainance reasons)
Thanks,
Ferdinand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can still reproduce these problems in 15.0.2 and will report them to the developers. Issue ID is DPD200367894.
You can continue to report issues here - if they are fixed in newer versions, we will let you know.
There is a limited return of non-commercial licenses - see https://software.intel.com/en-us/qualify-for-free-software - but Fortran is not currently included in the research or student offerings. This program is still evolving.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PS: I just noticed that the size is not specified in the allocation statements. In F2003-syntax, e.g. allocate(a(SIZE), source=...), the correct size will be printed in all snipptes, but accessing the array elements afterwards (even after correct initialization) fails with segmentation fault. Snippet 3 fails after correction with seg, fault even without any other changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can still reproduce these problems in 15.0.2 and will report them to the developers. Issue ID is DPD200367894.
You can continue to report issues here - if they are fixed in newer versions, we will let you know.
There is a limited return of non-commercial licenses - see https://software.intel.com/en-us/qualify-for-free-software - but Fortran is not currently included in the research or student offerings. This program is still evolving.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By the way, according to the F2008 standard you don't have to specify the bounds for a in the ALLOCATE as they are taken from the source. F2003 still requires that the bounds be given and that the source be "conformable" with the object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the valuable information and the bug report, Steve!
For now I will allocate with intent(out) in subroutines rather than allocatable function results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This turned out to be a simple bug when the source expression was a function result. I expect the fix to appear in Update 3 (May). Thanks for the nice test cases.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page