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

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Jan 24, 2019 at 01:32:56PM +0000, tkoenig at gcc dot gnu.org wrote:
> 
> However, I'd like to look at the code first and check if we
> can actually accommodate this strange behavior without pessimizing
> anything else.  If so, I would be inclined to "fix" this.
> 

I took a quick peek at the code.  I actually could not find
where we set iostat and iomsg if present.  For this simple
program 

program foo
   i = 42
   open(unit=7, file='tmp.dat')
   write(7,*) 'tmp.dat'
   close(7,iostat=i)
   print *, i
end program foo

the relevant part of -fdump-tree-original looks like

  {
    struct __st_parameter_close close_parm.2;

    close_parm.2.common.filename = &"t.f90"[1]{lb: 1 sz: 1};
    close_parm.2.common.line = 5;
    i = 0;
    close_parm.2.common.iostat = &i;
    close_parm.2.common.flags = 32;
    close_parm.2.common.unit = 7;
    _gfortran_st_close (&close_parm.2);
  }

So we pass the address of i in the close_parm, but I
don't see libgfortran/io/close.c doing anything with 
.iostat (or .iomsg).  In fact, st_close() doesn't
check the return status of remove()?

Of course, I could be missing something obvious.  Jerry?

Reply via email to