+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.
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);
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;