- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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
Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I just tried this using ifort 2021.5.0 on both Linux and Windows.
No error message printed on either OS.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
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
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Thanks for the clarification. My experience is mostly on Linux. I have limited experience with Windows and VS. I learned something new!

- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla