symbol.c (gfc_undo_symbols): Correctly undo namelists.

fortran/
	* symbol.c (gfc_undo_symbols): Correctly undo namelists.

testsuite/
	* gfortran.dg/namelist_75.f90: New test.

From-SVN: r191357
This commit is contained in:
Mikael Morin 2012-09-16 11:26:52 +00:00
parent ca4a1c8cb9
commit 15319c3ed9
4 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2012-09-16 Mikael Morin <mikael@gcc.gnu.org>
* symbol.c (gfc_undo_symbols): Correctly undo namelists.
2012-09-15 Tobias Burnus <burnus@net-b.de>
* trans-io.c (gfc_trans_transfer): Add an assert.

View File

@ -2996,7 +2996,7 @@ gfc_undo_symbols (void)
{
if (p->namelist_tail != old->namelist_tail)
{
gfc_free_namelist (old->namelist_tail);
gfc_free_namelist (old->namelist_tail->next);
old->namelist_tail->next = NULL;
}
}

View File

@ -1,3 +1,7 @@
2012-09-16 Mikael Morin <mikael@gcc.gnu.org>
* gfortran.dg/namelist_75.f90: New test.
2012-09-15 Tom de Vries <tom@codesourcery.com>
* gcc.dg/tree-ssa/vrp82.c: New test.

View File

@ -0,0 +1,10 @@
! { dg-do compile }
!
! Tests a write-after-free memory error fix in gfc_undo_symbols
program test_nml
namelist /foo/ bar, baz
namelist /foo/ wrong, , ! { dg-error "Syntax error in NAMELIST" }
end program test_nml