public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/101871] Array of strings of different length passed as an argument produces invalid result.
Date: Thu, 12 Aug 2021 16:05:49 +0000	[thread overview]
Message-ID: <bug-101871-4-l7QRI9mXow@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101871-4@http.gcc.gnu.org/bugzilla/>

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-08-12

--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to David Sagan from comment #0)

> 
> 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'])

For some reason, gfortran is ignoring the type-spec
in the array constructor of the actual argument if 
one uses the concatenation operator in the first
element of the constructor.  The length is set to
that of the first element.

This is going to be entertaining for whomever
takes on the challenge.  Here's a modified
test to consider

program tao_program

   implicit none

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

   name = 'H'
   abc = [character(80) :: 'a'//trim(name), 'ab', 'abc', 'd', 'def', 'g', &
   &  'ghi', 'z', 'zy']

   call io([character(80) :: 'a'//trim(name), 'ab', 'abc', 'd', &
   &  'def', 'g', 'ghi', 'z', 'zyxwvut'])

   print *

   abc = [character(80) :: 'a', 'ab', 'abc', 'd'//trim(name), 'def', 'g', &
   &  'ghi', 'z', 'zy']

   call io([character(80) :: 'a', 'ab', 'abc', 'd'//trim(name), &
   &  'def', 'g', 'ghi', 'z', 'zyxwvut'])

   contains

      subroutine io (lines)
         implicit none
         character(*) lines(:)
         integer i
         do i = 1, size(lines)
            write(*,'(I0,A)') i, ' ' // trim(abc(i)) // ' ' // trim(lines(i))
         end do
      end subroutine io

end program

  reply	other threads:[~2021-08-12 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12  3:28 [Bug fortran/101871] New: " david.sagan at gmail dot com
2021-08-12 16:05 ` kargl at gcc dot gnu.org [this message]
2021-08-12 18:43 ` [Bug fortran/101871] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101871-4-l7QRI9mXow@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).