summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-04-18 09:34:32 +0200
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-04-18 07:34:32 +0000
commit293fcb2e289bb7ae7bbff0583c7a127da776519a (patch)
tree4c37c80f5942a96de159382ba00989a0229cd146 /libgfortran
parent8c9de419a1b1e8cdcd9585ae59cfb6fac2420d99 (diff)
downloadgcc-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')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/inquire.c17
2 files changed, 16 insertions, 7 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 045f8ce1e75..f4716af402c 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-11 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR libfortran/20950
+ * io/inquire.c (inquire_via_unit): Check for the gfc_unit being
+ NULL when setting ioparm.sequential.
+
2005-04-17 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21075
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);
}