I am not 100% sure whether this is a duplicate of any of the other missed-optimization PRs; it may well be. Currently, gfortran generates a temporary for:
subroutine one() REAL, ALLOCATABLE :: kpts(:,:) REAL, POINTER :: syp(:,:) kpts = syp end subroutine one However, "kpts" cannot alias as it is neither a POINTER nor a TARGET; if there are components, one needs to be more careful - one also needs to check for POINTER in the ultra most component. (By the way, dependency.c's check_data_pointer_types needs to be modified to fix this.) -- Summary: Unnecessary array temporary - non-pointer/non-target does not alias Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43172