- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know that there are some strict restrictions on what can appear in the source= clause of the allocate statement, but I was surprised when trying to allocate a component of a derived type via sourced allocation where a sibling component (which is allocated and defined) resulted in the following error with ifort 13.0.2.171 Build 20130314:
[plain]
statN.F90(352): error #8152: Neither the ERRMSG= variable nor any part of the source expression in SOURCE= or MOLD= specifiers may be allocated in the ALLOCATE statement in which it appears. [THIS]
allocate(this%binkp(1:this%p-2,2:this%p) ,source=temp(1:this%p-2,:))
---------------------------------------------------------------^
[/plain]
this%p is already defined (it's not even allocatable) and this%binkp is the component I am trying to allocate. Simply replacing this%p by an additional variable (n = this%p) fixes the compile time error. gfortran 4.8.2 has no complaints when compiling the original code FWIW.
Does my statement violate the standard, or is this a bug?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will let Steve or someone familiar with the standards to resolve standard/bug issue.
Try: allocate(this%binkp(1:this%p-2,2:this%p) ,source=temp(1: ( this%p-2 ) ,:))
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's a bug. Jim's suggestion doesn't help. I'll report it to the developers. ifort needs to be more careful as to what it is looking at regarding the rules here (F2008. page 127, paragraph 3) Issue ID is DPD200250346.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed for a major release later this year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since we've now seen two other reports of this problem, the developers have agreed to put the fix into the 14.0 stream. I expect the fix to appear in Update 3.

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