- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See below for ALLOCATE statements that ICE when trying to allocate unlimited polymorphic components with a character source. Seems like the allocatable must be a component of a derived type and the source must be a variable to trigger the ICE. Notice the automatic variable allocation is fine. Also note integer sources work fine as well. In my code I am currently working around this by allocating in one step, and assigning in a second block that does type selection on the polymorphic component.
[fortran]module m8 type pair integer :: key class(*), allocatable :: val end type pair contains subroutine foo(c) character(len=*) :: c type(pair) :: p class(*), allocatable :: val character(len=6), parameter :: s = "hi joe" character(len=:), allocatable :: tmp integer :: i = 5 tmp = "hi joe" allocate (val, source = c) !OK; allocatable is not a component allocate (p%val, source = "hi joe") !ok; source is a literal allocate (p%val, source = s) !OK; source is a parameter allocate (p%val, source = i) !OK; source is an integer allocate (p%val, source = tmp) !0_12032 !: catastrophic error: **Internal compiler error: internal abort** allocate (p%val, source = c) !0_12032 !: catastrophic error: **Internal compiler error: internal abort** end subroutine foo end module m8[/fortran]
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Joseph,
Thanks - the issues with ALLOCATE are escalated as DPD200157386. Not that your program uses this, but I will comment that we do not currently support SOURCE= where the source is polymorphic - just in case you decided to try that.
The move_alloc issue is known and is being worked on. Issue ID is DPD200151581.
Thanks - the issues with ALLOCATE are escalated as DPD200157386. Not that your program uses this, but I will comment that we do not currently support SOURCE= where the source is polymorphic - just in case you decided to try that.
The move_alloc issue is known and is being worked on. Issue ID is DPD200151581.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also if you noticed the automatic val worked and you think a clever way to defeat the ICE is to move_alloc from the temporary to your component, you are mistaken :) Another ICE if you append this to the end of FOO above:
[fortran] call move_alloc (val,p%val) !catastrophic error: **Internal compiler error: internal abort** !-------^[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - we'll get this fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. Also while some of the allocations above compile OK the runtime behavior is suspect--they all crash on me. For those that are curious I've switched to code below to initialize unlimited polys with characters and it seems to be working ok. I'll switch it back when SOURCE= is debugged.
[fortran] allocate (character(len=len(c)):: p%val) select type (z => p%val) type is (character(len=*)) z = c end select[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Joseph,
Thanks - the issues with ALLOCATE are escalated as DPD200157386. Not that your program uses this, but I will comment that we do not currently support SOURCE= where the source is polymorphic - just in case you decided to try that.
The move_alloc issue is known and is being worked on. Issue ID is DPD200151581.
Thanks - the issues with ALLOCATE are escalated as DPD200157386. Not that your program uses this, but I will comment that we do not currently support SOURCE= where the source is polymorphic - just in case you decided to try that.
The move_alloc issue is known and is being worked on. Issue ID is DPD200151581.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Already tried polymorphic sources and your compiler gives a nice "not implemented yet" in that case instead of an ICE. When I have an unlimited poly I want to use with the current compiler I wrap it in a select type block to give the allocate statement something it can use. Unfortunately this adds unnecessary coupling in some of my generics so I'm looking forward to when all these source= issues are addressed and I can clean up my code to reduce the coupling from the type selection. For now I'm happy that most of what I want to do can be done with a few workarounds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed in Composer XE 2011 Update 6. Polymorphic source for ALLOCATE is also now supported.

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