This is the mail archive of the gcc-patches@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]

Re: PATCH: PR libgfortran/39664: [4.5 Regression] Revision 145571 breaks stdio


On Mon, Apr 6, 2009 at 3:59 PM, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
> On Mon, Apr 06, 2009 at 03:52:19PM -0700, H.J. Lu wrote:
>> STDOUT_FILENO, STDERR_FILENO and STDIN_FILENO are handled by C library.
>> libgfortran shouldn't close them for C library. Before revision 145571,
>> fd_close handled them correctly. ?OK for trunk?
>>
>
> By default, stdin is attached to unit 5 and stdout
> is attached to unit 6. ?Does the following work
> with your patch?
>
> program test
> ?close(6)
> ?call sub
> end program test
> !
> ! Write 'help' to unit=6, which should create file 'fort.6'
> !
> subroutine sub
> ? write(6) 'help'
> end subroutine sub
>

It works with my patch:

[hjl@gnu-16 pr39664]$ rm fort.6
[hjl@gnu-16 pr39664]$ cat x.f90
program test
 close(6)
 call sub
end program test
!
! Write 'help' to unit=6, which should create file 'fort.6'
!
subroutine sub
  write(6) 'help'
end subroutine sub
[hjl@gnu-16 pr39664]$ /export/gnu/import/rrs/145571/usr/bin/gfortran
x.f90[hjl@gnu-16 pr39664]$
LD_LIBRARY_PATH=/export/gnu/import/rrs/145571/usr/lib64 ./a.out
[hjl@gnu-16 pr39664]$ od -c fort.6
0000000 004  \0  \0  \0   h   e   l   p 004  \0  \0  \0
0000014
[hjl@gnu-16 pr39664]$



-- 
H.J.


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