- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Scalar allocatable class component works but array does not. Debugger does not show components of the extended type.
Perhaps this is a known issue (or am I making some mistake?)....please see the program below.
For input value of iType = 1:
When the class component is an array, I don't get the "real" component printed. The debugger shows the correct extented type picked up by the select case construct; however, the object "tree" in the debugger does not show the real component. The same is true for the scalar (variable Parcel%Object). However, the print-out does show the real component.
Abhi
=====
[fortran]Module OM Implicit None Type newBase Integer :: i = -1 Contains Procedure :: Show End Type newBase Type, extends(newBase) :: newExtension Real :: r = 1.0d0 End Type newExtension Contains Subroutine Show(OBJ) Class(newBase), Intent(IN) :: OBJ Select Type(OBJ) Type is (newBase) Print *, OBJ%i Type is (newExtension) Print *, OBJ%i, OBJ%r End Select End Subroutine Show End Module OM Module Shree Use OM Implicit None Type newWrapper Class(newBase), Allocatable :: Object(:) End Type newWrapper Type newCollection Class(newBase), Allocatable :: Object End Type newCollection End Module Shree Program Test_ClassInType Use Shree Implicit None Integer :: iType, ial(2) Type(newWrapper) :: Package Type(newCollection) :: Parcel Write(*,*) "Give iType: (0 or 1)" Read(*,*) iType Select Case(iType) Case(0) Allocate(newBase :: Package%Object(2), stat=ial(1)) Allocate(newBase :: Parcel%Object, stat=ial(2)) Case(1) Allocate(newExtension :: Package%Object(2), stat=ial(1)) Allocate(newExtension :: Parcel%Object, stat=ial(2)) Case Default Write(*,*) "Invalid." End Select Write(*,"(A,I0)") "ial(1)=", ial(1) Write(*,"(A,I0)") "ial(2)=", ial(2) Write(*,*) Write(*,*) "Showing Package%Object(1)" Call Package%Object(1)%Show() Write(*,*) Write(*,*) "Showing Parcel%Object" Call Parcel%Object%Show() End Program Test_ClassInType [/fortran]
- Balises:
- Intel® Fortran Compiler
Lien copié
4 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Is the issue that the debugger doesn't show the right value, but the program works anyway? Debugger support for polymorphic types has some issues we are working on.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi Steve
The problem is with both: (a) program does not work as expected, (b) debugger does not show correct information.
(a) More specifically, for iType == 1, Package%Obejct should be an array of extended type. However, this does not seem to happen. Whereas Parcel%Object is correctly becomes a variable of extended type. The write statement prints only integer component for Package%Object(1) while both, real and integer, components are printed for Parcel%Object.
(b) I am aware of issues related to the debugger; although this one also falls unders same category, I think, it is happening in a "new" place.
Abhi
The problem is with both: (a) program does not work as expected, (b) debugger does not show correct information.
(a) More specifically, for iType == 1, Package%Obejct should be an array of extended type. However, this does not seem to happen. Whereas Parcel%Object is correctly becomes a variable of extended type. The write statement prints only integer component for Package%Object(1) while both, real and integer, components are printed for Parcel%Object.
(b) I am aware of issues related to the debugger; although this one also falls unders same category, I think, it is happening in a "new" place.
Abhi
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Ok, thanks. I can reproduce both issues. I have escalated this as DPD200161615.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The program not working was fixed in 12.0 Update 2.
Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable