https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64426
Bug ID: 64426
Summary: Unnecessary string temporary for array assignment
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
After the fix for PR 56867, we now create temporaries for
program main
character(len=4) :: a
character(len=4) :: c(3)
c(1) = 'abcd'
c(2) = '1234'
c(3) = 'wxyz'
c(:)(1:2) = c(2)(1:2)
c(:)(1:2) = c(2)(3:4)
if (c(3) .ne. '23yz') call abort
end program main
bug.f90:7:14:
c(:)(1:2) = c(2)(1:2)
1
Warning: Creating array temporary at (1) [-Warray-temporaries]
bug.f90:8:14:
c(:)(1:2) = c(2)(3:4)
1
Warning: Creating array temporary at (1) [-Warray-temporaries]