From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BAAE63858D39; Thu, 6 Apr 2023 03:56:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAAE63858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680753383; bh=tiEp7pFcRlLorTBWGxJOwmARCJsZpSGOPHKEp8sNTPU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ohC1vMnPyUQhS5IiJSCjMJ/PwNnGy9+2JFISVk2G7HGpNkUWyxqlcP2OIIcFCZw15 +Z+0hPbfIO4GyxcTLh1o7+PRTfPtRmd6V87lajfJ8aps6ISZjg6FPIRJ7GJOoUlCE3 DLDAmKFPOgMggMXuRumMldA+Qlz9l4cH5aK2BUY0= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109358] Wrong formatting with T-descriptor during stream output Date: Thu, 06 Apr 2023 03:56:22 +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: 12.2.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: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109358 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #3 from kargl at gcc dot gnu.org --- (In reply to Jerry DeLisle from comment #2) > I am using my copy of the F2018 standard. >=20 > "13.8.1.2 The Tn edit descriptor indicates that the transmission of the n= ext > character to or from a record is to occur at the nth character position of > the record, relative to the left tab limit. This position can be in either > direction from the current position." >=20 > Currently we do this: >=20 > 1234567890123 > 1234 0123 > 1234 0123 >=20 > We should do this: >=20 > 1234567890123 > 1234 0123 > 1234 0123 >=20 > "13.5 (3) During formatted stream output, processing of an A edit descrip= tor > can cause file positioning to occur (13.7.4)." >=20 > I am not finding anything that says file positioning is not allowed. The > above is just elaborating different ways that an A edit descriptor affects > the positioning. Positioning is always done no matter what with the T > specifier. >=20 > Regardless, I do need to fix this. Yes, there is a bug. The A edit descriptor and whether or not it does file positioning is not relevant. The relevant words from F2018 are 13.8.1.2 T, TL, and TR editing The left tab limit affects file positioning by the T and TL edit descriptors. Immediately prior to nonchild data transfer (12.6.4.8.3), the left tab limit becomes defined as the character position of the current record or the current position of the stream file. If, during data transfer, the file is positioned to another record, the left tab limit becomes defined as character position one of that record. with write(fd, "(a)") "1234567890123" write(fd, "(a, t10, a)") "1234", "0123" ! A-descriptor, file positioning= =20 the left tab limit for the 2nd write is established before data transfer to position 1. The 'T10' edit descriptor is relative to that position. The write of "1234" in the 2nd write might place the character position to 5, but it does not update the left tab limit because the write() is not positioned to a new record.=