https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71902
Bug ID: 71902 Summary: [5/6/7 Regression] Unneeded temporary on reallocatable character assignment Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- After the fix for PR 71783, the original code from Toon's test case has an unnecessary temporary allocation. Translating character(len=ilen), allocatable :: cline(:) allocate(cline(2)) cline(1) = 'a' cline(2) = cline(1) yields BLOCK symtree: '__var_1_trim'|| symbol: '__var_1_trim' type spec : (CHARACTER () 1) attributes: (VARIABLE ALLOCATABLE) symtree: 'block@3' || symbol: 'block@3' type spec : (UNKNOWN 0) attributes: (LABEL ) ASSIGN block@3:__var_1_trim prtdata:cline(1) ASSIGN prtdata:cline(2) block@3:__var_1_trim END BLOCK This was not done in 4.9. So, dependency handling can be improved here.