diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-04-18 09:34:32 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-04-18 07:34:32 +0000 |
commit | 293fcb2e289bb7ae7bbff0583c7a127da776519a (patch) | |
tree | 4c37c80f5942a96de159382ba00989a0229cd146 /libgfortran/io/inquire.c | |
parent | 8c9de419a1b1e8cdcd9585ae59cfb6fac2420d99 (diff) | |
download | gcc-293fcb2e289bb7ae7bbff0583c7a127da776519a.tar.gz |
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
Diffstat (limited to 'libgfortran/io/inquire.c')
-rw-r--r-- | libgfortran/io/inquire.c | 17 |
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); } |