https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64692
Bug ID: 64692 Summary: Incorrect result for sourced allocate of class(*) array Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: antony at cosmologist dot info The following code gives incorrect output in trunk ('array 1' and 'array 2' should be the same): module Y contains subroutine AddArray(P) class(*), target, intent(in) :: P(:) class(*), pointer :: Pt(:) allocate(Pt(1:SIZE(P)), source= P) select type (P) type is (double precision) print *,'array 1',P end select select type (Pt ) type is (double precision) print *,'array 2',Pt end select end subroutine end module Y program test use Y double precision P(2,2) P(1:2,1)=[1.d0,2.d0] P(1:2,2) = [3.d0,4.d0] call AddArray(P(1:2,2)) end program test The select types are just there to show the output, they aren't needed for the bug.