On 15/09/2012 19:36, Tobias Burnus wrote:
> Hi Mikael,
> 
> thanks for your comments.
> 
> As a pre-script: Will you look at Paul's revised assignment patch - or
> should I do it?
I looked at it twice or so, and couldn't get the double temporary thing.
I'll get back to it.

> If you want to know the Coverity's diagnostic, you can also have access
> to GCC's Coverity scan results. Are you interested?
I have no plans to make anything out of them in the foreseeable future;
for later I don't know, why not.

> Thanks for the analysis. Will you create a patch?
> 
Attached. Tested against "*namelist*" and full regression test in
progress. OK?

Mikael



2012-09-16  Mikael Morin  <mik...@gcc.gnu.org>

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

2012-09-16  Mikael Morin  <mik...@gcc.gnu.org>

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

Index: symbol.c
===================================================================
--- symbol.c	(révision 191341)
+++ symbol.c	(copie de travail)
@@ -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;
 	    }
 	}



! { 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


Reply via email to