This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch fortran] PR 13919 - Runtime "internal error" in IO


Let's try this again :)

problem was a segfault with an empty input file, finish_list_read has to have something to work with or the setjmp / longjmp has big problems.


Here is a testsuite file, read_eof.f90:


! pr 13919, segfault when file is empty
      open(unit=8,file='/tmp/any_file')
      read(8,*,end=1)i
1     continue
      end


Works with this test as well as the code snippet included in the PR. no additional regressions.


Tested i686 / linux



--bud davis



Index: gcc/libgfortran/io/transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/Attic/transfer.c,v
retrieving revision 1.1.2.7
diff -c -3 -p -r1.1.2.7 transfer.c
*** gcc/libgfortran/io/transfer.c 7 Feb 2004 15:33:29 -0000 1.1.2.7
--- gcc/libgfortran/io/transfer.c 11 Feb 2004 02:01:46 -0000
*************** finalize_transfer (void)
*** 1306,1312 ****
if (current_unit == NULL)
return;
! if (ioparm.list_format && g.mode == READING)
finish_list_read ();
else
{
--- 1306,1312 ----
if (current_unit == NULL)
return;
! if (ioparm.list_format && g.mode == READING && current_unit->endfile == NO_ENDFILE)
finish_list_read ();
else
{




Bud Davis wrote:

the segfault was caused by a



Index: gcc/libgfortran/io/transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/Attic/transfer.c,v
retrieving revision 1.1.2.7
diff -c -3 -p -r1.1.2.7 transfer.c
*** gcc/libgfortran/io/transfer.c 7 Feb 2004 15:33:29 -0000 1.1.2.7
--- gcc/libgfortran/io/transfer.c 11 Feb 2004 02:01:46 -0000
*************** finalize_transfer (void)
*** 1306,1312 ****
if (current_unit == NULL)
return;
! if (ioparm.list_format && g.mode == READING)
finish_list_read ();
else
{
--- 1306,1312 ----
if (current_unit == NULL)
return;
! if (ioparm.list_format && g.mode == READING && current_unit->endfile
== NO_ENDFILE)
finish_list_read ();
else
{







-- C -------------------------------| C Bud Davis | C mailto:bdavis9659@comcast.net |--------------->>>>>>>> C http:/f77.linksysnet.com | C -------------------------------|



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]