https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90169
Bug ID: 90169 Summary: allocatable character in type Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: menospaamthereaper at hotmail dot com Target Milestone: --- The following code does not produce the correct result on gfortran 7.3.0 (and probably other versions): Program Main implicit none type str character(len=:),allocatable :: CStr(:) end type type(str) :: tstr allocate(character(len=2) :: tstr%CStr(2)) tstr%CStr(1) = "20" tstr%CStr(2) = "30" print *,'First: ',tstr%CStr(1) print *,'Second:',tstr%CStr(2) End Program Main The expected result is First: 20 Second:30 but the actual result is First: 30 Second:30 Note that this works as expected if CStr is not inside of a type. The details used in this example of the length, etc. do not matter. (This problem is also listed in 78578 but was not perhaps properly discussed and so was marked resolved / invalid)