public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/105456] New: Child I/O does not propage iostat
@ 2022-05-02 16:49 tkoenig at gcc dot gnu.org
  2022-05-02 16:50 ` [Bug libfortran/105456] " tkoenig at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2022-05-02 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105456
           Summary: Child I/O does not propage iostat
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

The program

module sk1
  implicit none
  type char
     character :: ch
  end type char
  interface read (formatted)
     module procedure read_formatted
  end interface read (formatted)
contains
  subroutine read_formatted (dtv, unit, iotype, vlist, iostat, iomsg)
    class (char), intent(inout) :: dtv
    integer, intent(in) :: unit
    character (len=*), intent(in) :: iotype
    integer, intent(in) :: vlist(:)
    integer, intent(out) :: iostat
    character (len=*), intent(inout) :: iomsg
    character :: ch
    read (unit,fmt='(A1)', advance="no", iostat=iostat, iomsg=iomsg) ch
    iostat = 42
    dtv%ch = ch
  end subroutine read_formatted
end module sk1

program skip1
  use sk1
  implicit none
  type (char) :: x
  open (10,status="scratch")
  write (10,'(A)') '', 'a'
  rewind (10)
  read (10,*) x
  write (*,'(10(A))') "Read: '",x%ch,"'"
end program skip1

runs to completion, but it should propagate the iostat to the
caller and error out on the read.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
@ 2022-05-02 16:50 ` tkoenig at gcc dot gnu.org
  2023-04-26  6:56 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2022-05-02 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |105361
           Keywords|                            |wrong-code
   Target Milestone|---                         |13.0
            Version|unknown                     |12.0


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105361
[Bug 105361] Incorrect end-of-file condition for derived-type I/O

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
  2022-05-02 16:50 ` [Bug libfortran/105456] " tkoenig at gcc dot gnu.org
@ 2023-04-26  6:56 ` rguenth at gcc dot gnu.org
  2023-07-27  9:23 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |13.2

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
  2022-05-02 16:50 ` [Bug libfortran/105456] " tkoenig at gcc dot gnu.org
  2023-04-26  6:56 ` rguenth at gcc dot gnu.org
@ 2023-07-27  9:23 ` rguenth at gcc dot gnu.org
  2023-08-15  3:10 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-07-27  9:23 ` rguenth at gcc dot gnu.org
@ 2023-08-15  3:10 ` jvdelisle at gcc dot gnu.org
  2024-02-22 19:13 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2023-08-15  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot gnu.org
                 CC|                            |jvdelisle at gcc dot gnu.org
   Last reconfirmed|                            |2023-08-15

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
On my list.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-08-15  3:10 ` jvdelisle at gcc dot gnu.org
@ 2024-02-22 19:13 ` jvdelisle at gcc dot gnu.org
  2024-02-25 22:55 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2024-02-22 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Created attachment 57504
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57504&action=edit
Proposed partial patch

Proposed patch for the original test case with a READ function.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-02-22 19:13 ` jvdelisle at gcc dot gnu.org
@ 2024-02-25 22:55 ` cvs-commit at gcc dot gnu.org
  2024-03-06  4:54 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-25 22:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:3f58f96a4e8255e222953f9856bcd6c25f7b33cd

commit r14-9168-g3f58f96a4e8255e222953f9856bcd6c25f7b33cd
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date:   Sun Feb 25 14:50:07 2024 -0800

    libgfortran: Propagate user defined iostat and iomsg.

            PR libfortran/105456

    libgfortran/ChangeLog:

            * io/list_read.c (list_formatted_read_scalar): Add checks
            for the case where a user defines their own error codes
            and error messages and generate the runtime error.
            * io/transfer.c (st_read_done): Whitespace.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr105456.f90: New test.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-02-25 22:55 ` cvs-commit at gcc dot gnu.org
@ 2024-03-06  4:54 ` cvs-commit at gcc dot gnu.org
  2024-03-07  3:58 ` cvs-commit at gcc dot gnu.org
  2024-03-12  1:08 ` jvdelisle at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-06  4:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:21edfb0051ed8d0ff46d5638c2bce2dd71f26d1f

commit r14-9328-g21edfb0051ed8d0ff46d5638c2bce2dd71f26d1f
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date:   Tue Mar 5 20:49:23 2024 -0800

    Fortran: Add user defined error messages for UDTIO.

    The defines IOMSG_LEN and MSGLEN were redundant so these are combined
    into IOMSG_LEN as defined in io.h.

    The remainder of the patch adds checks for when a user defined
    derived type IO procedure sets the IOSTAT or IOMSG variables
    independent of the librrary defined I/O messages.

            PR libfortran/105456

    libgfortran/ChangeLog:

            * io/io.h (IOMSG_LEN): Moved to here.
            * io/list_read.c (MSGLEN): Removed MSGLEN.
            (convert_integer): Changed MSGLEN to IOMSG_LEN.
            (parse_repeat): Likewise.
            (read_logical): Likewise.
            (read_integer): Likewise.
            (read_character): Likewise.
            (parse_real): Likewise.
            (read_complex): Likewise.
            (read_real): Likewise.
            (check_type): Likewise.
            (list_formatted_read_scalar): Adjust to IOMSG_LEN.
            (nml_read_obj): Add user defined error message.
            * io/transfer.c (unformatted_read): Add user defined error
            message.
            (unformatted_write): Add user defined error message.
            (formatted_transfer_scalar_read): Add user defined error message.
            (formatted_transfer_scalar_write): Add user defined error message.
            * io/write.c (list_formatted_write_scalar): Add user defined error
message.
            (nml_write_obj): Add user defined error message.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr105456-nmlr.f90: New test.
            * gfortran.dg/pr105456-nmlw.f90: New test.
            * gfortran.dg/pr105456-ruf.f90: New test.
            * gfortran.dg/pr105456-wf.f90: New test.
            * gfortran.dg/pr105456-wuf.f90: New test.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-03-06  4:54 ` cvs-commit at gcc dot gnu.org
@ 2024-03-07  3:58 ` cvs-commit at gcc dot gnu.org
  2024-03-12  1:08 ` jvdelisle at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-07  3:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:03932d3203bce244edd812b81921c2f16ea18d86

commit r14-9348-g03932d3203bce244edd812b81921c2f16ea18d86
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date:   Wed Mar 6 19:46:04 2024 -0800

    Fortran: Fix issue with using snprintf function.

    The previous patch used snprintf to set the message
    string. The message string is not a formatted string
    and the snprintf will interpret '%' related characters
    as format specifiers when there are no associated
    output variables. A segfault ensues.

    This change replaces snprintf with a fortran string copy
    function and null terminates the message string.

            PR libfortran/105456

    libgfortran/ChangeLog:

            * io/list_read.c (list_formatted_read_scalar): Use fstrcpy
            from libgfortran/runtime/string.c to replace snprintf.
            (nml_read_obj): Likewise.
            * io/transfer.c (unformatted_read): Likewise.
            (unformatted_write): Likewise.
            (formatted_transfer_scalar_read): Likewise.
            (formatted_transfer_scalar_write): Likewise.
            * io/write.c (list_formatted_write_scalar): Likewise.
            (nml_write_obj): Likewise.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr105456.f90: Revise using '%' characters
            in users error message.

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

* [Bug libfortran/105456] Child I/O does not propage iostat
  2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-03-07  3:58 ` cvs-commit at gcc dot gnu.org
@ 2024-03-12  1:08 ` jvdelisle at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2024-03-12  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Not planning any backport on this. Closing.

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

end of thread, other threads:[~2024-03-12  1:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 16:49 [Bug libfortran/105456] New: Child I/O does not propage iostat tkoenig at gcc dot gnu.org
2022-05-02 16:50 ` [Bug libfortran/105456] " tkoenig at gcc dot gnu.org
2023-04-26  6:56 ` rguenth at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2023-08-15  3:10 ` jvdelisle at gcc dot gnu.org
2024-02-22 19:13 ` jvdelisle at gcc dot gnu.org
2024-02-25 22:55 ` cvs-commit at gcc dot gnu.org
2024-03-06  4:54 ` cvs-commit at gcc dot gnu.org
2024-03-07  3:58 ` cvs-commit at gcc dot gnu.org
2024-03-12  1:08 ` 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).