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

            Bug ID: 62214
           Summary: Problem with spread plus concatenation for characters
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oliver.fuhrer at ginko dot ch

$ cat > test.f90
PROGRAM test
IMPLICIT NONE
CHARACTER(LEN=20)   :: fullNames(2)
CHARACTER(LEN=255)  :: pathName
CHARACTER(LEN=5)    :: fileNames(2)

pathName = "/dir1/dir2/"
fileNames = (/ "file1", "file2" /)
fullNames = SPREAD(TRIM(pathName),1,2) // fileNames
PRINT *, "fullNames: ",fullNames

END PROGRAM test

$ gfortran -O0 test.f90

$ ./a.out
fullNames: /dir1/dir2/file1    /dir1/dir2/file2

$ gfortran -O1 test.f90

$ ./a.out
fullNames: /dir1/dir2/         /dir1/dir2/

Reply via email to