From: Francois-Xavier Coudert Date: Mon, 18 Apr 2005 07:34:32 +0000 (+0200) Subject: re PR libfortran/20950 ([4.0 only] segfault in INQUIRE asking for SEQUENTIAL status) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=293fcb2e289bb7ae7bbff0583c7a127da776519a;p=platform%2Fupstream%2Fgcc.git 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f6cf35..1dd0db7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-11 Francois-Xavier Coudert + + PR libfortran/20950 + * gfortran.dg/pr20950.f: New test. + 2005-04-18 Francois-Xavier Coudert PR libfortran/19216 diff --git a/gcc/testsuite/gfortran.dg/pr20950.f b/gcc/testsuite/gfortran.dg/pr20950.f new file mode 100644 index 0000000..c132548 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20950.f @@ -0,0 +1,7 @@ +! PR libfortran/20950 +! Original bug-report by Walt Brainerd, The Fortran Company +! { dg-do run } + character*20 c + inquire (33, sequential = c) + if (c .ne. "UNKNOWN") call abort + end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 045f8ce..f4716af 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2005-04-11 Francois-Xavier Coudert + + 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 PR libfortran/21075 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); }