From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EE9C33858D33; Fri, 31 Mar 2023 10:49:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE9C33858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680259771; bh=bu+FoqeXxzUiazZxx4oM+PJ9irJhFy1zibngiYYkwfg=; h=From:To:Subject:Date:From; b=m6DM9RAPFc2NdVr5nNsiQfu60hs+BCy91YrmZsqBkFjrm1Y+2a8MQkRZYl0KwP0p7 esDHpzzLlSeK63K9I04MjCB9E77F+W9Zx3Ff/Xx+pDiH0rBNAtDRUMtFZQYYSWN5GD pOGwl0WoCtUC0WQor0USuUjaG4BH3FsCmj7CTGeI= From: "baradi09 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109358] New: Wrong formatting with T-descriptor during stream output Date: Fri, 31 Mar 2023 10:49:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: baradi09 at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 Bug ID: 109358 Summary: Wrong formatting with T-descriptor during stream output Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: baradi09 at gmail dot com Target Milestone: --- This is a very minor bug, but probably easy to fix. It seems, that the T da= ta edit descriptor handling is non-standard conforming when using formatted st= ream I/O: Given the following MWE: program tabformat implicit none integer :: fd open(newunit=3Dfd, file=3D"test.stream.txt", access=3D"stream", form=3D"f= ormatted")=20=20 write(fd, "(a)") "1234567890123" write(fd, "(a, t10, a)") "1234", "0123" ! A-descriptor, file positioning allowed=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 write(fd, "(i4, t10, i4.4)") 1234, 0123 ! I-descriptor, file positioning not allowed=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 close(fd) end program tabformat The resulting file contains 1234567890123 1234 0123 # 9 spaces between blocks 1234 0123 # 9 spaces between blocks Apparently, a file positioning takes place during the execution of the write statement.=20 However, if I understand 13.7.1 =C2=A71 correctly, file positioning may onl= y happen with the A-descriptor (and it is optional even there). So the standard conforming output would be either (if file positioning happens after the A-descriptor) 1234567890123 1234 0123 # 9 spaces 1234 0123 # 5 spaces or (if no file positioning happens after the A-descriptor) 1234567890123 1234 0123 # 5 spaces 1234 0123 # 5 spaces I personally would prefer latter, and it would be also equivalent to the behavior of the Intel and NAG compilers.=