- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
This simple program compiles:
PROGRAM test_chr
IMPLICIT NONE
WRITE(*,*) int2str0(12,5)
CONTAINS
FUNCTION int2str0(I,Pos)
INTEGER, INTENT(IN) :: I
INTEGER, INTENT(IN) :: Pos
CHARACTER(LEN=Pos) :: int2str0
INTEGER :: j
WRITE(int2str0,'(I<Pos>)',IOSTAT=j) I
IF(j /= 0) THEN
WRITE(*,*) 'Error: Pos parameter too small!'
STOP
END IF
j = INDEX(int2str0,' ',.TRUE.)
int2str0(1:j) = REPEAT('0',j)
END FUNCTION int2str0
END PROGRAM test_chr
However, when I put this function inside a module, e.g.,
MODULE util
IMPLICIT NONE
CONTAINS
FUNCTION int2str0(I,Pos)
INTEGER, INTENT(IN) :: I
INTEGER, INTENT(IN) :: Pos
CHARACTER(LEN=Pos) :: int2str0
INTEGER :: j
WRITE(int2str0,'(I<Pos>)',IOSTAT=j) I
IF(j /= 0) THEN
WRITE(*,*) 'Error: Pos parameter too small!'
STOP
END IF
j = INDEX(int2str0,' ',.TRUE.)
int2str0(1:j) = REPEAT('0',j)
END FUNCTION int2str0
END MODULE util
the compiler throws the error with the message:
xfortcom: Fatal: There has been an internal compiler error (C0000005).
What is the problem here?
Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
We will get a bug report on this. Reproducer is:
MODULE util
IMPLICIT NONE
CONTAINS
FUNCTION int2str0(I,Pos)
INTEGER, INTENT(IN) :: I
INTEGER, INTENT(IN) :: Pos
CHARACTER(LEN=Pos) :: int2str0
INTEGER :: j
WRITE(int2str0,'(I<Pos>)',IOSTAT=j) I
IF(j /= 0) THEN
WRITE(*,*) 'Error: Pos parameter too small!'
STOP
END IF
j = INDEX(int2str0,' ',.TRUE.)
int2str0(1:j) = REPEAT('0',j)
END FUNCTION int2str0
END MODULE util
Thank you for sending this to us.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Thanks Ron for the follow-up to the original post.
It may help Intel Support team as well as readers to note the internal compiler error occurs with IFX, Classic compiler viz. IFORT v2021.7 didn't throw such an error.
I checked IFORT out of concern for a senior scientist colleague (a hobbyist legacy FORTRAN 77 style coder who writes some code for some individual tasks at work) who has a similar functions to convert numeric types to strings and uses IFORT as part of Intel oneAPI.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I think I have found a temporary solution for this problem - I added a local variable and used it in the format clause.
FUNCTION int2str0(I,Pos)
INTEGER, INTENT(IN) :: I
INTEGER, INTENT(IN) :: Pos
CHARACTER(LEN=Pos) :: int2str0
INTEGER :: j, p
p = Pos
WRITE(int2str0,'(I<p>)',IOSTAT=j) I
IF(j /= 0) THEN
WRITE(*,*) 'Error: Pos parameter too small!'
STOP
END IF
j = INDEX(int2str0,' ',.TRUE.)
int2str0(1:j) = REPEAT('0',j)
END FUNCTION int2str0
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The error has been reproduced and escalated with a bug report. I will let you know when there is an update on it.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I still have the same error when compiled with the newest compiler version oneAPI 2023.0...
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The fix will be in 2024.0 Intel Fortran Compiler.
- 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