[Bug libfortran/105456] Child I/O does not propage iostat

2024-03-11 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

Jerry DeLisle  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #8 from Jerry DeLisle  ---
Not planning any backport on this. Closing.

[Bug libfortran/105456] Child I/O does not propage iostat

2024-03-06 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

--- Comment #7 from GCC Commits  ---
The master branch has been updated by Jerry DeLisle :

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

commit r14-9348-g03932d3203bce244edd812b81921c2f16ea18d86
Author: Jerry DeLisle 
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.

[Bug libfortran/105456] Child I/O does not propage iostat

2024-03-05 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

--- Comment #6 from GCC Commits  ---
The master branch has been updated by Jerry DeLisle :

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

commit r14-9328-g21edfb0051ed8d0ff46d5638c2bce2dd71f26d1f
Author: Jerry DeLisle 
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.

[Bug libfortran/105456] Child I/O does not propage iostat

2024-02-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

--- Comment #5 from GCC Commits  ---
The master branch has been updated by Jerry DeLisle :

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

commit r14-9168-g3f58f96a4e8255e222953f9856bcd6c25f7b33cd
Author: Jerry DeLisle 
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.

[Bug libfortran/105456] Child I/O does not propage iostat

2024-02-22 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

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

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

[Bug libfortran/105456] Child I/O does not propage iostat

2023-08-14 Thread jvdelisle at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

Jerry DeLisle  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  ---
On my list.

[Bug libfortran/105456] Child I/O does not propage iostat

2023-07-27 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|13.2|13.3

--- Comment #2 from Richard Biener  ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

[Bug libfortran/105456] Child I/O does not propage iostat

2023-04-26 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|13.0|13.2

--- Comment #1 from Richard Biener  ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

[Bug libfortran/105456] Child I/O does not propage iostat

2022-05-02 Thread tkoenig at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105456

Thomas Koenig  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