From 3e14aaa2aa50a8ef28da096379f33e776c544d93 Mon Sep 17 00:00:00 2001 From: Bud Davis Date: Sat, 26 Jun 2004 11:49:06 +0000 Subject: [PATCH] re PR libfortran/16196 (gfortran fails to create file with OPEN(...,status='REPLACE')) 2004-06-26 Bud Davis 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 | 5 +++++ .../gfortran.fortran-torture/execute/open_replace.f90 | 5 +++++ libgfortran/ChangeLog | 5 +++++ libgfortran/io/unix.c | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.fortran-torture/execute/open_replace.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 048a3089806..16661d340b2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-06-26 Bud Davis + + PR gfortran/pr16196 + * gfortran.fortran-torture/execute/open_replace.f90: New test case. + 2004-06-25 Roger Sayle 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 index 00000000000..1d8ac4ba787 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/open_replace.f90 @@ -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 diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 3422af9884d..b1babff4f6d 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2004-06-26 Bud Davis + + PR gfortran/16196 + * unix.c(regular_file): create file if it does not exist. + 2004-06-24 Andrew Pinski * configure.ac: Remove check for libmx. diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index fc25395ca5b..0800447ba2e 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -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: -- 2.30.2