This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/78881] [F03] reading from string with DTIO procedure does not work properly


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

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #5)
> (In reply to Jerry DeLisle from comment #3)
> > (In reply to janus from comment #2)
> > > (In reply to janus from comment #0)
> > > > It seems like the first character is being swallowed somewhere ...
> > > 
> > > Moreover the EOF is supposed to be an EOR?
> > 
> > I will start looking at this. I wonder off hand if we have an EOF because we
> > start reading one position off. I will see what I can figure out.
> 
> Hi Jerry,
> 
> I was just reviewing all the outstanding DTIO PRs. Did you get anywhere with
> this one?
> 
> Cheers
> 
> Paul

I have been digging around and found one place where we were not passing the
correct unit number to the child procedure. 

$ git diff libgfortran/io/unit.c
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index ed3bc323..9535b004 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -461,6 +461,7 @@ set_internal_unit (st_parameter_dt *dtp, gfc_unit *iunit,
int kind)
 {
   gfc_offset start_record = 0;

+  iunit->unit_number = dtp->common.unit;
   iunit->recl = dtp->internal_unit_len;
   iunit->internal_unit = dtp->internal_unit;
   iunit->internal_unit_len = dtp->internal_unit_len;

This fixes part of the problem. I have not nailed down why we fail to write out
the value in the child procedure once we have the internal unit number. Likely
we are exiting the write machinery too soon.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]