public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109358] New: Wrong formatting with T-descriptor during stream output
@ 2023-03-31 10:49 baradi09 at gmail dot com
  2023-03-31 20:27 ` [Bug fortran/109358] " jvdelisle at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: baradi09 at gmail dot com @ 2023-03-31 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

            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 data
edit descriptor handling is non-standard conforming when using formatted stream
I/O:

Given the following MWE:

program tabformat
  implicit none

  integer :: fd

  open(newunit=fd, file="test.stream.txt", access="stream", form="formatted")  
  write(fd, "(a)") "1234567890123"
  write(fd, "(a, t10, a)") "1234", "0123"  ! A-descriptor, file positioning
allowed                                 
  write(fd, "(i4, t10, i4.4)") 1234, 0123  !  I-descriptor, file positioning
not allowed                               
  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. 

However, if I understand 13.7.1 §1 correctly, file positioning may only 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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-02-19  2:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 10:49 [Bug fortran/109358] New: Wrong formatting with T-descriptor during stream output baradi09 at gmail dot com
2023-03-31 20:27 ` [Bug fortran/109358] " jvdelisle at gcc dot gnu.org
2023-04-06  2:48 ` jvdelisle at gcc dot gnu.org
2023-04-06  3:56 ` kargl at gcc dot gnu.org
2023-04-15  3:31 ` jvdelisle at gcc dot gnu.org
2023-04-16  8:18 ` baradi09 at gmail dot com
2023-06-02  1:51 ` jvdelisle at gcc dot gnu.org
2023-06-02  5:17 ` sgk at troutmask dot apl.washington.edu
2024-02-03 18:28 ` jvdelisle at gcc dot gnu.org
2024-02-08 18:14 ` jvdelisle at gcc dot gnu.org
2024-02-08 18:17 ` jvdelisle at gcc dot gnu.org
2024-02-12 20:05 ` jvdelisle at gcc dot gnu.org
2024-02-12 23:30 ` cvs-commit at gcc dot gnu.org
2024-02-13  3:26 ` cvs-commit at gcc dot gnu.org
2024-02-14 19:58 ` jvdelisle at gcc dot gnu.org
2024-02-17 20:16 ` anlauf at gcc dot gnu.org
2024-02-19  2:38 ` jvdelisle at gcc dot gnu.org

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).