From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 95F2E385782D; Thu, 12 Aug 2021 16:05:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95F2E385782D From: "kargl at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed cc bug_status cf_reconfirmed_on Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 16:05:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101871 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) >=20 > 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\', '=20 > \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=20 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 =3D 'H' abc =3D [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 =3D [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 =3D 1, size(lines) write(*,'(I0,A)') i, ' ' // trim(abc(i)) // ' ' // trim(lines(i= )) end do end subroutine io end program=