summaryrefslogtreecommitdiff
path: root/libgfortran/io/inquire.c
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-18 07:34:32 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-18 07:34:32 +0000
commit214b69f2f8af56a4881be331e5f9b670c4910fa7 (patch)
tree4c37c80f5942a96de159382ba00989a0229cd146 /libgfortran/io/inquire.c
parent79d22d52d49de6a0f3fc0d8c0398c14a3998d848 (diff)
downloadgcc-214b69f2f8af56a4881be331e5f9b670c4910fa7.tar.gz
PR libfortran/20950
* io/inquire.c (inquire_via_unit): Check for the gfc_unit being NULL when setting ioparm.sequential. * gfortran.dg/pr20950.f: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98312 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/inquire.c')
-rw-r--r--libgfortran/io/inquire.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index 1f0fcac6530..731adad7c86 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -87,13 +87,16 @@ inquire_via_unit (gfc_unit * u)
if (ioparm.sequential != NULL)
{
- /* disallow an open direct access file to be accessed
- sequentially */
- if (u->flags.access==ACCESS_DIRECT)
- p = "NO";
- else
- p = (u == NULL) ? inquire_sequential (NULL, 0) :
- inquire_sequential (u->file, u->file_len);
+ if (u == NULL)
+ p = inquire_sequential (NULL, 0);
+ else
+ {
+ /* disallow an open direct access file to be accessed sequentially */
+ if (u->flags.access == ACCESS_DIRECT)
+ p = "NO";
+ else
+ p = inquire_sequential (u->file, u->file_len);
+ }
cf_strcpy (ioparm.sequential, ioparm.sequential_len, p);
}