diff mbox

[libgfortran] PR59419 Failing OPEN with FILE='xxx' and IOSTAT creates the file 'xxx'

Message ID 20131216151502.106E2104@mailhost.lps.ens.fr
State New
Headers show

Commit Message

Dominique d'Humières Dec. 16, 2013, 3:15 p.m. UTC
Hi Jerry,

Glad to see you back!

I stumbled on this pr while trying to clean the files left after the tests
(see http://gcc.gnu.org/ml/fortran/2013-10/msg00083.html, note that
gfortran.dg/c_loc_test_22.f90 has already been applied). I have a pending
patch cleaning the remaining files; the full cleaning being blocked by the pr.
With your patch 2 out of 3 files no longer appear. The last one is due to
gfortran.dg/open_negative_unit_1.f90 because foo.txt is not deleted after
the second open. I think this is the intended behavior and I propose the following
patch:


The first part check that foo.txt exists and delete it.
The inquire checks that the file is not created again.
The test regtest with your patch and abort without it.

> I will conjure up a test case for this.

Unless you have already such a test, I think the above will be enough.

Cheers,

Dominique

PS Could you please have a look at pr48906 comment 40?
I have the impression that it is fixed and IMO if some issues
remain, it would probably better to open new PR for them.
diff mbox

Patch

--- ../_clean//gcc/testsuite/gfortran.dg/open_negative_unit_1.f90	2013-03-20 09:20:18.000000000 +0100
+++ gcc/testsuite/gfortran.dg/open_negative_unit_1.f90	2013-12-16 15:51:33.000000000 +0100
@@ -6,6 +6,7 @@ 
 
 program nutest
     implicit none
+    logical l
     integer id, ios
 
     open(newunit=id, file="foo.txt", iostat=ios)
@@ -16,6 +17,14 @@  program nutest
 
     close(id, status="delete")
 
+    open(unit=10, file="foo.txt", status="old", iostat=ios)
+    if (ios /= 0) call abort
+
+    close(10, status="delete")
+
     open(-10, file="foo.txt", iostat=ios)
     if (ios == 0) call abort
+
+    inquire(file="foo.txt", exist=l)
+    if (l) call abort
 end program nutest