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

            Bug ID: 101871
           Summary: Array of strings of different length passed as an
                    argument produces invalid result.
           Product: gcc
           Version: og10 (devel/omp/gcc-10)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.sagan at gmail dot com
  Target Milestone: ---

Consider the test program:

program tao_program

implicit none
integer i
character(80) abc(9)
character(40) name

name = 'abasdfadsf'

abc = [character(80):: &
            'Beam parameters not computed at: ' // trim(name), &
            'Singular sigma matrix is:', &
            '  \6es15.7\', '  \6es15.7\', '  \6es15.7\', '  \6es15.7\', ' 
\6es15.7\', '  \6es15.7\', &
            'Will not print any more singular sigma matrices']

do i = 1, size(abc)
  print '(i6, 2x, a)', i, trim(abc(i))
enddo

call out_io_lines2 ([character(80):: &
        'Beam parameters not computed at: ' // trim(name), &
        'Singular sigma matrix is:', &
        '  \6es15.7\', '  \6es15.7\', '  \6es15.7\', '  \6es15.7\', ' 
\6es15.7\', '  \6es15.7\', &
        'Will not print any more singular sigma matrices'])

contains

subroutine out_io_lines2 (lines)

implicit none
character(*) lines(:)
integer i

do i = 1, size(lines)
  print '(i6, 2x, a)', i, trim(lines(i))
enddo

end subroutine out_io_lines2
end program



Now compile and run:
> gfortran tao_program.f90 
mac-mini-2:~/Bmad/test> ./a.out 
     1  Beam parameters not computed at: abasdfadsf
     2  Singular sigma matrix is:
     3    \6es15.7\
     4    \6es15.7\
     5    \6es15.7\
     6    \6es15.7\
     7    \6es15.7\
     8    \6es15.7\
     9  Will not print any more singular sigma matrices
     1  Beam parameters not computed at: abasdfadsf
     2  Singular sigma matrix is:
     3    \6es15.7\
     4    \6es15.7\
     5    \6es15.7\
     6    \6es15.7\
     7    \6es15.7\
     8    \6es15.7\
     9  Will not print any more singular sigma matr

Notice that the second "9" line is truncated. This should not be.

Reply via email to