From 7ba18cea5442cd8b2bc67ab4c07e73297963627b Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Mon, 24 Oct 2005 20:20:40 +0000 Subject: re PR libfortran/24416 (Wrong reading following namelist reading) 2005-10-24 Paul Thomas PR fortran/24416 * libgfortran/io/list_read.c (namelist_read): Exit with call to free_saved () so that character strings do not accumulate. 2005-10-24 Paul Thomas PR fortran/24416 gfortran.dg/namelist_char_only.f90: New test. From-SVN: r105862 --- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gfortran.dg/namelist_char_only.f90 | 29 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/namelist_char_only.f90 (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa6e53c..1151980 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-24 Paul Thomas + + PR fortran/24416 + gfortran.dg/namelist_char_only.f90: New test. + 2005-10-24 Asher Langton PR fortran/17031 diff --git a/gcc/testsuite/gfortran.dg/namelist_char_only.f90 b/gcc/testsuite/gfortran.dg/namelist_char_only.f90 new file mode 100644 index 0000000..eb2d7ea --- /dev/null +++ b/gcc/testsuite/gfortran.dg/namelist_char_only.f90 @@ -0,0 +1,29 @@ +! { dg-do run } +! { dg-options "-O0" } +! Test patch for PR24416.f90 - a used to come back from the read with var +! prepended. +! + IMPLICIT NONE + CHARACTER(len=10) :: var = "hello" + character(len=10) :: a = "" + NAMELIST /inx/ var + + OPEN(unit=11, status='scratch') + write (11, *) "&INX" + write (11, *) " var = 'goodbye'" + write (11, *) "&END" + rewind (11) + + READ(11,NML=inx) + CLOSE(11) + + OPEN(unit=11, status='scratch') + write (11, *) "alls_well" + rewind (11) + + READ(11,*) a + CLOSE(11) + + if (a /= "alls_well") call abort () + +END \ No newline at end of file -- cgit v1.1