https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84495

            Bug ID: 84495
           Summary: Incorrect result for concatenation of Fortran
                    allocatable string
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.sagan at gmail dot com
  Target Milestone: ---

Using gfortran 7.3.0:

Davids-Mac-mini:~/Bmad> gfortran --version
GNU Fortran (MacPorts gcc7 7.3.0_0) 7.3.0


Test program is:

program test
character(:), allocatable :: str
allocate(character(3) :: str)
str = '123456789'
print *, str
str = str(1:3) // 'A' // str(6:)
print *, str
end program


Running gives:

Davids-Mac-mini:~/Bmad> gfortran test.f90
Davids-Mac-mini:~/Bmad> ./a.out 
 123456789
 123A678 

Notice that the second line is missing a "9" at the end. That is, it should be
"123A6789".

Reply via email to