public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101871] New: Array of strings of different length passed as an argument produces invalid result.
@ 2021-08-12  3:28 david.sagan at gmail dot com
  2021-08-12 16:05 ` [Bug fortran/101871] " kargl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: david.sagan at gmail dot com @ 2021-08-12  3:28 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-16  0:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12  3:28 [Bug fortran/101871] New: Array of strings of different length passed as an argument produces invalid result david.sagan at gmail dot com
2021-08-12 16:05 ` [Bug fortran/101871] " kargl at gcc dot gnu.org
2021-08-12 18:43 ` anlauf at gcc dot gnu.org
2021-08-12 19:21 ` kargl at gcc dot gnu.org
2021-08-14  0:59 ` kargl at gcc dot gnu.org
2021-08-15 19:21 ` anlauf at gcc dot gnu.org
2021-08-16  0:30 ` sgk at troutmask dot apl.washington.edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).