From 293fcb2e289bb7ae7bbff0583c7a127da776519a Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Mon, 18 Apr 2005 09:34:32 +0200 Subject: re PR libfortran/20950 ([4.0 only] segfault in INQUIRE asking for SEQUENTIAL status) 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. From-SVN: r98312 --- libgfortran/io/inquire.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'libgfortran/io/inquire.c') diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index 1f0fcac..731adad 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); } -- cgit v1.1