re PR libfortran/16196 (gfortran fails to create file with OPEN(...,status='REPLACE'))
authorBud Davis <bdavis9659@comcast.net>
Sat, 26 Jun 2004 11:49:06 +0000 (11:49 +0000)
committerBud Davis <bdavis@gcc.gnu.org>
Sat, 26 Jun 2004 11:49:06 +0000 (11:49 +0000)
2004-06-26  Bud Davis  <bdavis9659@comcast.net>

        PR gfortran/16196
        * unix.c(regular_file): create file if it does not exist.
        * gfortran.fortran-torture/execute/open_replace.f90: New test case.

From-SVN: r83709

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/open_replace.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/unix.c

index 048a30898060d064440381793ac6b301f8de61a1..16661d340b2dc035ae40d919dc6afd7b7797f573 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-26  Bud Davis  <bdavis9659@comcast.net>
+
+       PR gfortran/pr16196
+       * gfortran.fortran-torture/execute/open_replace.f90: New test case.
+
 2004-06-25  Roger Sayle  <roger@eyesopen.com>
 
        PR middle-end/15825
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/open_replace.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/open_replace.f90
new file mode 100644 (file)
index 0000000..1d8ac4b
--- /dev/null
@@ -0,0 +1,5 @@
+! pr 16196
+! open with 'REPLACE' creates the file if it does not exist.
+      PROGRAM iobug
+      OPEN(UNIT=10,FILE='gfcoutput.txt',status='REPLACE')
+      END PROGRAM iobug
index 3422af9884da82c62b144e4c5d01a7a330a6e08e..b1babff4f6da39b7b954b4f3020de037983cdee1 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-26  Bud Davis  <bdavis9659@comcast.net>
+
+       PR gfortran/16196
+       * unix.c(regular_file): create file if it does not exist.
+
 2004-06-24  Andrew Pinski  <apinski@apple.com>
 
        * configure.ac: Remove check for libmx.
index fc25395ca5b05b82d24bbd8f897e8117b9ca01f0..0800447ba2e4a47029fe6814254aefe4a2086849 100644 (file)
@@ -982,7 +982,7 @@ regular_file (unit_action action, unit_status status)
       break;
 
     case STATUS_REPLACE:
-      mode |= O_TRUNC;
+        mode |= O_CREAT | O_TRUNC;
       break;
 
     default: