https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93690
Bug ID: 93690 Summary: Type Bound Generic Assignment Bug Using Intrinsic Assignments Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: floschiffmann at gmail dot com Target Milestone: --- Good morning, I ran across a problem when using a Type bound assignment (TBA). I have two type, the type with TBA type(Inner), and type (Outer) which has inner as a member. If now Type(outer) is assigned to another type(outer), the Inner assignment is only called if it is done elementwise. The vector assignment does not call the type(Inner) assignment. As I understand the standard, the vector assignment should call the TBA element by element. As a side note, the assignment is called if assignMe is made ELEMENTAL IMPURE. While nice as a work around, I can't see an obvious reason why this would be the correct behavior. Here is the test code, which shows this behavior !============================ Example start ========================= MODULE Classes IMPLICIT NONE TYPE Inner CONTAINS PROCEDURE :: assignMe GENERIC :: assignment(=) => assignMe END TYPE TYPE Outer TYPE(Inner) :: mInner END TYPE CONTAINS SUBROUTINE assignMe(self, input) CLASS(Inner), INTENT(OUT) :: self CLASS(Inner), INTENT(IN) :: input WRITE(*,*)"ASSIGNMENT CALLED" END SUBROUTINE END MODULE PROGRAM test USE Classes IMPLICIT NONE TYPE(Outer) :: mOuter(1), reassigned(1) WRITE(*,*)"Intrinsic assignment works when called element wise" reassigned(1)=mOuter(1) WRITE(*,*)"Does not work when called as vector assignment" reassigned=mOuter END PROGRAM !============================ Example end ========================= best regards Flo