From 1ef02b9de5bc2b05d07e2fa15d5f62b7fa6ddfdd Mon Sep 17 00:00:00 2001 From: Bud Davis Date: Fri, 13 Aug 2004 22:01:02 +0000 Subject: [PATCH] re PR libfortran/16935 (Segmentation fault of compiler with unsupported control items in OPEN) 2004-08-13 Bud Davis PR gfortran/13965 * gfortran.fortran-torture/execute/open_rewind.f90: New test. * io/open.c (st_open): use flags instead of the unit structure. From-SVN: r85966 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/pr16935.f90 | 7 +++++++ libgfortran/ChangeLog | 5 +++++ libgfortran/io/open.c | 4 ++-- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr16935.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad541935f08..c3cafd2afa3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-08-13 Bud Davis + + * gfortran.fortran-torture/execute/open_rewind.f90: New test. + 2004-08-13 Janis Johnson * g++.dg/ext/altivec-2.C: Revert previous changes and don't execute. diff --git a/gcc/testsuite/gfortran.dg/pr16935.f90 b/gcc/testsuite/gfortran.dg/pr16935.f90 new file mode 100644 index 00000000000..63f540057fd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr16935.f90 @@ -0,0 +1,7 @@ +! { dg-do run } +! pr16935 +! segfault at run time on open statement + program bug2 + implicit none + open( 1 , file = "str_500.txt", position = "REWIND" ) + end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c6f1a8df05d..e622e3155bd 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2004-08-13 Bud Davis + + PR gfortran/13965 + * io/open.c (st_open): use flags instead of the unit structure. + 2004-08-10 Victor Leikehman * io/list_read.c (namelist_read): Convert variable names diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index cd70622baf7..f88bdeccf59 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -506,8 +506,8 @@ st_open (void) if (ioparm.unit < 0) generate_error (ERROR_BAD_OPTION, "Bad unit number in OPEN statement"); - if (flags.position != POSITION_UNSPECIFIED && - u->flags.access == ACCESS_DIRECT) + if (flags.position != POSITION_UNSPECIFIED + && flags.access == ACCESS_DIRECT) generate_error (ERROR_BAD_OPTION, "Cannot use POSITION with direct access files"); -- 2.30.2