diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-08-26 22:04:48 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-08-26 22:04:48 +0000 |
commit | 128997b6a50945943c47b02ca4d743e22e4d4786 (patch) | |
tree | 179fe2796441d99ba4d1e150090496d54cca0623 /libgfortran | |
parent | 070b797d0a7c4032bcadf58a0b29a4cc65fd5587 (diff) | |
download | gcc-128997b6a50945943c47b02ca4d743e22e4d4786.zip gcc-128997b6a50945943c47b02ca4d743e22e4d4786.tar.gz gcc-128997b6a50945943c47b02ca4d743e22e4d4786.tar.bz2 |
re PR libfortran/33055 (Runtime error in INQUIRE unit existance with -fdefault-integer-8)
2007-08-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33055
* trans-io.c (create_dummy_iostat): New function to create a unique
dummy variable expression to use with IOSTAT.
(gfc_trans_inquire): Use the new function to pass unit number error info
to run-time library if a regular IOSTAT variable was not given.
PR libfortran/33055
* io/inquire.c (inquire_via_unit): If inquiring by unit, check for
an error condition from the IOSTAT variable and set EXIST to false if
there was a bad unit number.
From-SVN: r127817
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/inquire.c | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 10e6009..2659670 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2007-08-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/33055 + * io/inquire.c (inquire_via_unit): If inquiring by unit, check for + an error condition from the IOSTAT variable and set EXIST to false if + there was a bad unit number. + 2007-08-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/32972 diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index b1f4a14..547b831 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -47,7 +47,17 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) GFC_INTEGER_4 cf = iqp->common.flags; if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0) - *iqp->exist = iqp->common.unit >= 0; + { + *iqp->exist = (iqp->common.unit >= 0 + && iqp->common.unit <= GFC_INTEGER_4_HUGE); + + if ((cf & IOPARM_INQUIRE_HAS_FILE) == 0) + { + if (!(*iqp->exist)) + *iqp->common.iostat = ERROR_BAD_UNIT; + *iqp->exist = *iqp->exist && (*iqp->common.iostat != ERROR_BAD_UNIT); + } + } if ((cf & IOPARM_INQUIRE_HAS_OPENED) != 0) *iqp->opened = (u != NULL); |