From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 73B6B385EC57; Sat, 17 Feb 2024 20:16:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73B6B385EC57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708200972; bh=3bIi/gAN8F4koT/9EbM9CUjYDrsiWuSsz/h62Wov2rw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pSHKEGp59x43nwtW11xdtmzt1dbgwo0STyXRNtK+20c/RMSpNLqmkLEsmo+nelPAO PCttJ93F98PcRBmNGPCju0n7DuPwMBdsRQkAosvReWoNsQCZG/WWOgFOw3p68umF2H ianJ1zJFy8Z+CWdpyhUQxNkF5AV2XR10dtPoSirs= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109358] Wrong formatting with T-descriptor during stream output Date: Sat, 17 Feb 2024 20:16:10 +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: anlauf at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc bug_status resolution 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 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #15 from anlauf at gcc dot gnu.org --- Jerry, I tend to think the fix does not cover loopholes like multiple tabbing or nX without printing anything in between. Consider the enhanced test: program tabs implicit none integer :: fd open(newunit=3Dfd, file=3D"test-stream.txt", form=3D"formatted", access= =3D"stream") write(fd, "(a)") "12345678901234567890123456789" write(fd, "(i4, t25, t2, i4.4)") 1234, 0123 ! wrong write(fd, "(i4, t25, 1x, t2, i4.4)") 1234, 0123 ! wrong write(fd, "(i4, t21, a, t2, i4.4)") 1234, "good", 0123 ! OK write(fd, "(i4, t40, i4, t20, i5.5)") 1234, 5555, 67890 ! OK close(fd) open(newunit=3Dfd, file=3D"test.txt", form=3D"formatted") write(fd, "(a)") "12345678901234567890123456789" write(fd, "(i4, t25, t2, i4.4)") 1234, 0123 ! wrong write(fd, "(i4, t25, 1x, t2, i4.4)") 1234, 0123 ! wrong write(fd, "(i4, t21, a, t2, i4.4)") 1234, "good", 0123 ! OK write(fd, "(i4, t40, i4, t20, i5.5)") 1234, 5555, 67890 ! OK close(fd) end program tabs Expected: =3D=3D> test-stream.txt <=3D=3D 12345678901234567890123456789 10123 10123 10123 good 1234 67890 5555 =3D=3D> test.txt <=3D=3D 12345678901234567890123456789 10123 10123 10123 good 1234 67890 5555 With gcc-13/gcc-14 after your patch I get: =3D=3D> test-stream.txt <=3D=3D 12345678901234567890123456789 1234 0123 1234 0123 10123 good 1234 67890 5555 =3D=3D> test.txt <=3D=3D 12345678901234567890123456789 1234 0123 1234 0123 10123 good 1234 67890 5555 Can you have a further look?=