This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] patch for PR 16935--segfault from OPEN
- From: Bud Davis <bdavis at gcc dot gnu dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Thu, 12 Aug 2004 20:54:54 -0500
- Subject: [gfortran] patch for PR 16935--segfault from OPEN
problem was a rather obvious typo that was not found until
the "position='REWIND'" open option was used. u is NULL
until later on when the unit is searched for.
no additional regression i686/gnu/linux FC1.
--bud
test suite file:
! pr16935
! segfault at run time on open statement
program bug2
implicit none
open( 1 , file = "str_500.txt", position = "REWIND" )
end
Change log:
2004-08-12 Bud Davis <bdavis9659@comcast.net>
* io/open.c (st_open): use flags instead of the unit structure.
Index: gcc/libgfortran/io/open.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/open.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 open.c
*** gcc/libgfortran/io/open.c 15 May 2004 20:44:38 -0000 1.3
--- gcc/libgfortran/io/open.c 13 Aug 2004 01:40:30 -0000
*************** st_open (void)
*** 507,513 ****
generate_error (ERROR_BAD_OPTION, "Bad unit number in OPEN statement");
if (flags.position != POSITION_UNSPECIFIED &&
! u->flags.access == ACCESS_DIRECT)
generate_error (ERROR_BAD_OPTION,
"Cannot use POSITION with direct access files");
--- 507,513 ----
generate_error (ERROR_BAD_OPTION, "Bad unit number in OPEN statement");
if (flags.position != POSITION_UNSPECIFIED &&
! flags.access == ACCESS_DIRECT)
generate_error (ERROR_BAD_OPTION,
"Cannot use POSITION with direct access files");