https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83613
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Can you try this and report:
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index 6ba1224d77c..fefe6e9a165 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -47,9 +47,9 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u)
generate_error (&iqp->common, LIBERROR_INQUIRE_INTERNAL_UNIT, NULL);
if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0)
- *iqp->exist = (u != NULL &&
- iqp->common.unit != GFC_INTERNAL_UNIT &&
- iqp->common.unit != GFC_INTERNAL_UNIT4)
+ *iqp->exist = ((u != NULL) &&
+ (iqp->common.unit != GFC_INTERNAL_UNIT) &&
+ (iqp->common.unit != GFC_INTERNAL_UNIT4))
|| (iqp->common.unit >= 0);
if ((cf & IOPARM_INQUIRE_HAS_OPENED) != 0)