Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

MOVE_ALLOC documentation error

jimdempseyatthecove
Honored Contributor III
518 Views

The description of MOVE_ALLOC (at least in the .034 Release Notes) is incorrect:

"If TO is currently allocated, it is deallocated. Then, if FROM is allocated, TO becomes allocated with the same bounds and value identical to that of FROM. Lastly, FROM is deallocated. If TO has the TARGET attribute, any pointer associated with FROM at the time of the call to MOVE_ALLOC is now associated with TO."

FROM is not deallocated, it is dissassociated. If FROM were deallocated then TO would reference deallocated memory.

Jim Dempsey

0 Kudos
4 Replies
Steven_L_Intel1
Employee
518 Views
Thanks, you're correct and we'll fix it.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
518 Views
Um, I'm not sure I agree. There's no such thing as a "disassociated allocatable" in the Fortran standard. I think you're mixing in the underlying Intel's implementation (which is simple copying of descriptors, just like with pointers).

As far as the Standard is concerned, MOVE_ALLOC could work like:
* Allocate new memory for TO
* Copy all the contents from FROM to TO
* Deallocate FROM
* Go through the list of associated pointers (yes I know it doesn't exist in IFC) to FROM and "redirect" them to TO.

I don't have a fresh enough Standard handy, but I'd betcha it doesn't mention "disassociated" in this context.
0 Kudos
Steven_L_Intel1
Employee
518 Views

Well, no, that's not how MOVE_ALLOC works. The wording in the standard is actually:

The allocation status of FROM becomes unallocated.

You're correct that it does not say disassociated.

0 Kudos
jimdempseyatthecove
Honored Contributor III
518 Views

Although (by your words) the standard does not use disassociated to describe the behavior of FROM after MOVE_ALLOC, disassociated is likely the correct adjective to use. Look at NULLIFY in regards to pointers: "Disassociates a pointer from a target".

Disassociated, means there is no associated data accompanying the token (no allocation for allocatable, null pointer or null descriptor for pointer).

Part of my reasons for this thread is to obtain top performance on multi-core systems. To do this, it is desireable to take full advantage of vectorization. And, to do this, it is desireable to eliminate the test for alignment (e.g. so short iteration counts can take advantage of vectorizations).

Pointers are convienently use to point to array slices as well as for link pointers in object collections. Having the pointer carry the alignment attribute (for the data to which it points) reduces the probibility of coding error as well as increases the probability of compiler opportunity to vectorize without generating code to test for and advance to alignment (and perform vectorization of low iteration count loops).

Jim Dempsey

0 Kudos
Reply