aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2007-10-15 13:59:02 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2007-10-15 13:59:02 +0000
commit6ae786d29d88806d1a1f3572c405238cae53b43f (patch)
tree9fcc0b343db23973f9b0cbdca0bac810e90d8235
parent1033834f3b0bc6fa0c8db5a03c412d3a2b05b9d2 (diff)
downloadgcc-6ae786d29d88806d1a1f3572c405238cae53b43f.zip
gcc-6ae786d29d88806d1a1f3572c405238cae53b43f.tar.gz
gcc-6ae786d29d88806d1a1f3572c405238cae53b43f.tar.bz2
re PR libfortran/33055 (Runtime error in INQUIRE unit existance with -fdefault-integer-8)
2007-10-15 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. From-SVN: r129344
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/io/inquire.c13
2 files changed, 19 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 2b9e67e..34df500 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-15 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-10-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33672
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index 2c16a3b..493b223 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -45,7 +45,18 @@ 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 = LIBERROR_BAD_UNIT;
+ *iqp->exist = *iqp->exist
+ && (*iqp->common.iostat != LIBERROR_BAD_UNIT);
+ }
+ }
if ((cf & IOPARM_INQUIRE_HAS_OPENED) != 0)
*iqp->opened = (u != NULL);