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, fortran] PR 39667 cleanup use of temp files testsuite


On Thu, Aug 27, 2009 at 17:54, Daniel Kraft<d@domob.eu> wrote:
> Hi Janne,
>
> Janne Blomqvist wrote:
>>
>> It turned out that my checking program caused behavior different from
>> when running the testsuite due to some testcases not properly cleaning
>> up after themselves in some cases (typically ftruncate() is called
>> after opening an existing file). The attached patch cleans up all of
>> the ones fixed above, except one, by using randomly named temp files
>> that are immediately deleted after opening (mkstemp() or some more or
>> less insecure fallback, aka status="scratch" in Fortran terms).
>>
>> The one testcase left, fmt_t_7.f, closes and then reopens a file, so
>> can't use the status="scratch" trick. ?So I left the target
>> fd_truncate requirement there in case there happens to be a file
>> called fort.10 lying around.
>>
>> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
> Ok.

Thanks, committed as r151144.

>?Thanks for the patch, I like the cleanup very much ;) ?Just one
> comment:
>
> diff --git a/gcc/testsuite/gfortran.dg/namelist_56.f90
> b/gcc/testsuite/gfortran.dg/namelist_56.f90
> index 8d879fc..658d12f 100644
> --- a/gcc/testsuite/gfortran.dg/namelist_56.f90
> +++ b/gcc/testsuite/gfortran.dg/namelist_56.f90
> @@ -1,4 +1,4 @@
> -! { dg-do run { target fd_truncate } }
> +! { dg-do run }
> ?! PR37707 Namelist read of array of derived type incorrect
> ?! Test case from Tobias Burnus
> ? IMPLICIT NONE
> @@ -10,6 +10,7 @@
> ? j = -42
> ? nlstr = '&nml str = "a", "b", "cde", j = 5 /'
> ? read(nlstr,nml)
> + ?open(99, status="scratch")
> ? write(99,nml)
> ? rewind(99)
> ? j = -54
>
> I'm no expert on Fortran IO, but before 99 was ever opened in this file --
> how did it work? ?But that's of course no problem with your patch, just
> curious! ?(The same with read_repeat.f90.)

If the unit is not previously open, it opens it with a default
filename (gfortran like many other compilers uses fort.XX where XX is
the unit number) and some default options (sequential formatted etc.).
One of the oddities of Fortran, probably dating back to the time
before file systems when unit XX literally meant "line printer on
channel XX" or something like that.

> And I did not look at your Python code (because I never really bothered with
> Python so far), but that's probably ok, I hope :D

It wasn't supposed to be reviewed nor committed anyway; it was just
the checking program I used, in case anyone is curious.


-- 
Janne Blomqvist


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