Assignment to an allocatable array not working (using -assume realloc_lhs)

Assignment to an allocatable array not working (using -assume realloc_lhs)

If you use the -assume realloc_lhs or -standard-semantics compile flags to get standard-conforming behavior, assignment to an allocatable lhs array works properly under most circumstances.  However, here is an example (attached) where it doesn't.  In this case the rhs vector is polymorphic and the assignment statement is in one of the TYPE IS stanzas of a SELECT TYPE construct applied to the polymorphic vector.  This is standard conforming and works with other compilers, but the Intel 14.0.2 compiler produces code that gives a run-time error at that assignment statement.  See the attached example.

Downloadapplication/octet-stream intel-bug-20140424.f902.23 KB
7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thank you for reporting this and for the convenient reproducer Neil. I have reproduced this and escalated it to our Fortran Development team (see internal tracking id below) for analysis/repair and will keep your post updated regarding the status of a fix.

(Internal tracking id: DPD200255963)

Resolution Update on 08/10/2015): This defect is fixed in the Intel® Parallel Studio XE 2015 Update 3 release (2015.0.090 - Linux)


Is this a regression, meaning it worked previously but got broken due to other changes in the compiler?  I ask because I think I've used such a feature successfully in some of my code built most likely with compiler version 13 on Windows but it may take me some time to dig through a ton of code across many libraries to find it.


FortranFan, Your situation may be different, but in my case I'm seeing this error for 13.1.2 as well.

It does not appear to be a regression. My findings concur with Neil's. I checked back to 12.1 where it was also present. It is also present in the current 15.0 Beta compiler.

Incidently, my work-around for the assignment in

select type (v)
type is (integer)
  val = v
end select

is to replace it with

  if (allocated(val)) deallocate(val)
  allocate(val(size(v)), source=v)

It's not exactly the same (val is always reallocated) but it's working in my use cases.

Neil, I discovered that this defect was fixed in the Intel® Parallel Studio XE 2015 release (2015.0.090 - Linux) after investigating a similar issue. I must have missed an earlier notification of that. My apologies for the delayed notification.

Leave a Comment

Please sign in to add a comment. Not a member? Join today