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

Component access via a class pointer contained in an array of types gives wrong result

thomas_boehme
Nuevo Colaborador II
993 Vistas
Unfortunately, I think I have encountered yet another IVF11.1 bug.
It seems that component access to integer and real values via a class pointer gives the wrong result if the class pointer is contained in an array of a type. See the attached code. The first write statement outputs the wrong values.

Interestingly, in this particular case, the debugger does display the correct information, but the code fails. Also, it seem that only integer and real as displayed wrong. Characters work fine, also TYPEs and POINTERS to other objects seem to work fine.

It works ok if using a class pointer directly. The second write give the right results.

The bug appears with IVF 11.1.051, I did not try older releases.


[plain]    program CompAccessBug
    implicit none
! Type definitions
    TYPE :: BaseType
      INTEGER :: i
      REAL :: r
      CHARACTER :: c
    END TYPE
    TYPE :: ExtType
      INTEGER :: i2
    END TYPE
    TYPE TypePtr
      CLASS (BaseType), POINTER :: Ptr
    END TYPE
! Variables
    TYPE (BaseType), TARGET :: ExtInst
    TYPE (TypePtr) :: PtrInst(1)
    class (BaseType), POINTER :: Ptr
! ------
    print *, 'Hello World'
    ExtInst%i = 1
    ExtInst%r = 2.0
    ExtInst%c = 'c'
    PtrInst(1)%Ptr => ExtInst
    
    WRITE(*,*) PtrInst(1)%Ptr%i, PtrInst(1)%Ptr%r, PtrInst(1)%Ptr%c
    Ptr=>PtrInst(1)%Ptr
    WRITE(*,*) Ptr%i, Ptr%r, Ptr%c
    end program CompAccessBug

[/plain]
0 kudos
4 Respuestas
Steven_L_Intel1
Empleados
993 Vistas
Thanks, we'll take a look.
Steven_L_Intel1
Empleados
993 Vistas
Escalated as issue DPD200141737. This is not a new bug in that it was broken from the original 11.1.
Steven_L_Intel1
Empleados
993 Vistas
I expect the fix for this to be in Update 5.
Steven_L_Intel1
Empleados
993 Vistas
It actually got fixed in 11.1 Update 6, available now.
Responder