- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code prints out a non-zero value for ERROR (the value is -858993460). I don't understand how MOVE_ALLOC fails here.
This is with Intel Fortran Compiler Classic 2021.5.0, on Windows 10, x64, non-coarray code.
It also looks like there is a non-printable character in MESSAGE - but that's probably a different problem.
MODULE M
IMPLICIT NONE
TYPE :: W
END TYPE W
TYPE :: T
TYPE(W), ALLOCATABLE :: A(:)
CONTAINS
PROCEDURE :: P
END TYPE T
CONTAINS
SUBROUTINE P(SELF, A)
IMPLICIT NONE
CLASS(T), INTENT(INOUT) :: SELF
TYPE(W), ALLOCATABLE, INTENT(INOUT) :: A(:)
CHARACTER(LEN = 132) :: MESSAGE
INTEGER :: ERROR
CALL MOVE_ALLOC(A, SELF%A, STAT = ERROR, ERRMSG = MESSAGE)
IF (ERROR /= 0 ) THEN
WRITE(*, *) ERROR, (MESSAGE == ' '), TRIM(MESSAGE)
STOP
END IF
END SUBROUTINE P
END MODULE M
PROGRAM MAIN
USE M
IMPLICIT NONE
TYPE(T) :: VAR
TYPE(W), ALLOCATABLE :: A(:)
ALLOCATE(A(1))
CALL VAR%P(A)
END PROGRAM MAIN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please see this other thread by OP and comments in there re: debug compile (/Od) and the treatment of the optional STAT= dummy argument as possibly INTENT(INOUT) versus INTENT(OUT) per the standard, and Ron Green's investigation, etc. Some or all of it may be relevant to this thread also:
https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-MOVE-ALLOC/m-p/1368121#M160577
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tried this using ifort 2021.5.0 on both Linux and Windows.
No error message printed on either OS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Barbra,
The issue was, on no error condition, the STAT= variable would be left untouched.
Therefore, should you have run your test from a Debug build, it would have pre-initialized the STAT variable ERROR with 0, and thus would not be a conclusive test. A proper test would be to pre-set the STAT variable ERROR to non-zero before the call to MOVE_ALLOC.
Now, you may have done this with your test program, but the sample program, and your reply, give no assurance that you had done so.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please see this other thread by OP and comments in there re: debug compile (/Od) and the treatment of the optional STAT= dummy argument as possibly INTENT(INOUT) versus INTENT(OUT) per the standard, and Ron Green's investigation, etc. Some or all of it may be relevant to this thread also:
https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-MOVE-ALLOC/m-p/1368121#M160577
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the clarification. My experience is mostly on Linux. I have limited experience with Windows and VS. I learned something new!

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