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 <jvdeli...@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.