https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81116
Bug ID: 81116 Summary: Last character of allocatable-length string reset to blank in an assigment Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: clivegpage at gmail dot com Target Milestone: --- This program shows that the last character of "string" is replaced by a blank, but when a different variable is on the left side of the assignment the expected result is obtained: program test10 implicit none character(:), allocatable :: string, new ! string = '1234567890' string = string(1:5) // string(7:) print *, ' string="', string, '"' ! string = '1234567890' new = string(1:5) // string(7:) print *,' new= "', new, '"' end program test10 The output I get is: string="12345789 " new= "123457890"