-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorflang:runtime
Description
Consider the following test case:
MODULE mDerivedModule
TYPE :: tTypeDerived(k1) ! (4)
INTEGER, KIND :: K1
INTEGER(4) :: i
INTEGER(4) :: j
CONTAINS
FINAL :: tTypeDerivedFinal
END TYPE tTypeDerived
CONTAINS
SUBROUTINE tTypeDerivedFinal( o )
TYPE(tTypeDerived(4)) :: o( :,:,: )
print*, "in final."
END SUBROUTINE tTypeDerivedFinal
END MODULE mDerivedModule
PROGRAM allocatedArrayDerived02
USE mDerivedModule
INTEGER(4) :: i
TYPE(tTypeDerived(4)) :: derivedArray( 2,2,2 ) =&
RESHAPE((/ (tTypeDerived(4)( i,(8 - i) ), i = 1, 8) /), (/ 2,2,2 /))
TYPE(tTypeDerived(4)), ALLOCATABLE :: derivedArrayAlloc( :,:,: )
ALLOCATE(derivedArrayAlloc( 3,3,3 ),&
SOURCE=RESHAPE((/ (tTypeDerived(4)( (27 - i),i ), i = 27, 1, -1) /),&
(/ 3,3,3 /)))
derivedArrayAlloc = derivedArray. !!! Finalization should occur here.
END PROGRAM allocatedArrayDerived02
Expected behavior:
a.out
in final
Actual behavior:
a.out
It will work as expected if I
- remove the KIND type parameter from the derived type definition, OR
- remove the static initialization from the variables.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorflang:runtime