public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: Jerry D <jvdelisle2@gmail.com>, gfortran <fortran@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, libgfortran] PR105456 Child I/O does not propage iostat
Date: Sun, 25 Feb 2024 21:34:52 +0100	[thread overview]
Message-ID: <e47b7369-3da3-4840-a886-66f10d9fc429@gmx.de> (raw)
In-Reply-To: <701a3111-c3b5-422c-bee7-50ba00e3847a@gmail.com>

Hi Jerry,

On 2/22/24 20:11, Jerry D wrote:
> Hi all,
>
> The attached fix adds a check for an error condition from a UDDTIO
> procedure in the case where there is no actual underlying error, but the
> user defines an error by setting the iostat variable manually before
> returning to the parent READ.

the libgfortran fix LGTM.

Regarding the testcase code, the following looks like you left some
debugging code in it:

+  rewind (10)
+  read (10,*) x
+  print *, myerror, mymessage
+  write (*,'(10(A))') "Read: '",x%ch,"'"

myerror and mymessage are never set and never tested.

I suggest to either remove them or to enhance the testcase e.g. like

   rewind (10)
   read (10,*,iostat=myerror,iomsg=mymessage) x
   if (myerror /= 42 .or. mymessage /= "The users message") stop 1
   rewind (10)
   read (10,*) x
   write (*,'(10(A))') "Read: '",x%ch,"'"

I'll leave that up to you.

> I did not address the case of a formatted WRITE or unformatted
> READ/WRITE until I get some feedback on the approach. If this approach
> is OK I would like to commit and then do a separate patch for the cases
> I just mentioned.

I haven't thought about this long enough, but I do not anything wrong
with your patch.

> Feedback appreciated.  Regression tested on x86_64. OK for trunk?

This is OK.

Thanks,
Harald

> Jerry
>
> Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
> Date:   Thu Feb 22 10:48:39 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.
>
>      gcc/testsuite/ChangeLog:
>
>              * gfortran.dg/pr105456.f90: New test.


  reply	other threads:[~2024-02-25 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 19:11 Jerry D
2024-02-25 20:34 ` Harald Anlauf [this message]
2024-02-25 22:58   ` Jerry D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e47b7369-3da3-4840-a886-66f10d9fc429@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jvdelisle2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).