aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-15 03:57:29 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-15 03:57:29 +0000
commit64c7e3f76ab9e24bbe16374c72cb0f0f075600be (patch)
tree98ba117cae5b6d67f036681fc0d0f0d0fe87b0fd /libgfortran
parent579c5597a64f43fcb4ba79568646beff75e32083 (diff)
2015-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61933 * io/inquire.c (inquire_via_unit): Set existing to true if a gfc_unit stucture was found for the given unit number. * runtime/error.c (translate_error): Add case for LIBERROR_INQUIRE_INTERNAL_UNIT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/io/inquire.c16
-rw-r--r--libgfortran/runtime/error.c4
3 files changed, 16 insertions, 12 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 4e3ba2308b6..33fb6dad9e5 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/61933
+ * io/inquire.c (inquire_via_unit): Set existing to true if a
+ gfc_unit stucture was found for the given unit number.
+ * runtime/error.c (translate_error): Add case for
+ LIBERROR_INQUIRE_INTERNAL_UNIT.
+
2015-01-05 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index b53b1de5422..21367a6d83f 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -41,19 +41,11 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
const char *p;
GFC_INTEGER_4 cf = iqp->common.flags;
- if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0)
- {
- *iqp->exist = (iqp->common.unit >= 0
- && iqp->common.unit <= GFC_INTEGER_4_HUGE);
+ if (iqp->common.unit == -1)
+ generate_error (&iqp->common, LIBERROR_INQUIRE_INTERNAL_UNIT, NULL);
- 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_EXIST) != 0)
+ *iqp->exist = (u != NULL);
if ((cf & IOPARM_INQUIRE_HAS_OPENED) != 0)
*iqp->opened = (u != NULL);
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index e2df96d23a9..098231916aa 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -488,6 +488,10 @@ translate_error (int code)
p = "Unformatted file structure has been corrupted";
break;
+ case LIBERROR_INQUIRE_INTERNAL_UNIT:
+ p = "Inquire statement identifies an internal file";
+ break;
+
default:
p = "Unknown error code";
break;