diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-03-31 17:30:06 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-03-31 15:30:06 +0000 |
commit | 14fd645e24c0924bbcc0a7f5fa85b7534cd3c4f2 (patch) | |
tree | f9c088e9e155088b3460b11a74badd8a49363196 /libgfortran | |
parent | 406490a8492a82c538db3aa6b43b5cffb9d05b42 (diff) | |
download | gcc-14fd645e24c0924bbcc0a7f5fa85b7534cd3c4f2.zip gcc-14fd645e24c0924bbcc0a7f5fa85b7534cd3c4f2.tar.gz gcc-14fd645e24c0924bbcc0a7f5fa85b7534cd3c4f2.tar.bz2 |
re PR libfortran/20660 (INQUIRE incorrectly reports the existence of UNITS)
PR libfortran/20660
* io/inquire.c (inquire_via_unit): Non-opened units should still be
reported by an INQUIRE statement as existing.
* io/transfer.c (data_transfer_init): Never accept negative units.
PR libfortran/20660
* gfortran.dg/negative_unit.f: New test.
From-SVN: r97326
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/inquire.c | 7 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 6 |
3 files changed, 19 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index edc23af..0272638 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2005-03-31 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/20660 + * io/inquire.c (inquire_via_unit): Non-opened units should still be + reported by an INQUIRE statement as existing. + * io/transfer.c (data_transfer_init): Never accept negative units. + 2005-03-29 Dale Ranta <dir@lanl.gov> Francois-Xavier Coudert <coudert@clipper.ens.fr> diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index 28c2f6a..1f0fcac 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -46,7 +46,12 @@ inquire_via_unit (gfc_unit * u) const char *p; if (ioparm.exist != NULL) - *ioparm.exist = (u != NULL); + { + if (ioparm.unit >= 0) + *ioparm.exist = 1; + else + *ioparm.exist = 0; + } if (ioparm.opened != NULL) *ioparm.opened = (u != NULL); diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index aed0aa9..4d48323 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -935,6 +935,12 @@ data_transfer_init (int read_flag) current_unit = get_unit (read_flag); if (current_unit == NULL) { /* Open the unit with some default flags. */ + if (ioparm.unit < 0) + { + generate_error (ERROR_BAD_OPTION, "Bad unit number in OPEN statement"); + library_end (); + return; + } memset (&u_flags, '\0', sizeof (u_flags)); u_flags.access = ACCESS_SEQUENTIAL; u_flags.action = ACTION_READWRITE; |