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

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

thomas_boehme
New Contributor II
964 Views
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 Replies
Steven_L_Intel1
Employee
964 Views
Thanks, we'll take a look.
0 Kudos
Steven_L_Intel1
Employee
964 Views
Escalated as issue DPD200141737. This is not a new bug in that it was broken from the original 11.1.
0 Kudos
Steven_L_Intel1
Employee
964 Views
I expect the fix for this to be in Update 5.
0 Kudos
Steven_L_Intel1
Employee
964 Views
It actually got fixed in 11.1 Update 6, available now.
0 Kudos
Reply