aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-10-24 20:20:40 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-10-24 20:20:40 +0000
commit2bc6cef132b8b2bf8f3288685c23660c356e6276 (patch)
tree5c5fd990d242774c49c6f17cc3197d870ec10922
parent8ad14095ba6bd00f698733b6cb0fa416e5e5ead7 (diff)
2005-10-24 Paul Thomas <pault@gcc.gnu.org>
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 <pault@gcc.gnu.org> PR fortran/24416 gfortran.dg/namelist_char_only.f90: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@105862 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_char_only.f9029
-rw-r--r--libgfortran/ChangeLog14
-rw-r--r--libgfortran/io/list_read.c3
4 files changed, 46 insertions, 5 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fa6e53c018c..1151980d511 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-10-24 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/24416
+ gfortran.dg/namelist_char_only.f90: New test.
+
2005-10-24 Asher Langton <langton2@llnl.gov>
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 00000000000..eb2d7ea83d0
--- /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
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6dd23590d52..52ad1a91f64 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,9 +1,15 @@
+2005-10-24 Paul Thomas <pault@gcc.gnu.org>
+
+ 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-23 Jerry DeLisle <jvdelisle@verizon.net>
- PR libgfortran/24489
- * io/transfer.c (read_block): Change the order of execution to not read
- past end-of-record.
- (read_block_direct): Same change.
+ PR libgfortran/24489
+ * io/transfer.c (read_block): Change the order of execution to not read
+ past end-of-record.
+ (read_block_direct): Same change.
2005-10-23 Francois-Xavier Coudert <coudert@clipper.ens.fr>
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index c3510f6ae61..2e1717ab463 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2364,13 +2364,14 @@ find_nml_name:
}
}
-
+ free_saved ();
return;
/* All namelist error calls return from here */
nml_err_ret:
+ free_saved ();
generate_error (ERROR_READ_VALUE , nml_err_msg);
return;
}