This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] Fix some issues found by Coverity's static-code analysis scan
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Sun, 16 Sep 2012 12:12:13 +0200
- Subject: Re: [Patch, Fortran] Fix some issues found by Coverity's static-code analysis scan
- References: <50544E8A.5040704@net-b.de> <50549E90.7000204@sfr.fr> <5054BC84.7040203@net-b.de>
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 <mikael@gcc.gnu.org>
* symbol.c (gfc_undo_symbols): Correctly undo namelists.
2012-09-16 Mikael Morin <mikael@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