This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix --enable-checking=valgrind failure on enum_5.f90 (PR fortran/43029)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Thu, 11 Feb 2010 19:53:49 +0100
- Subject: [PATCH] Fix --enable-checking=valgrind failure on enum_5.f90 (PR fortran/43029)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
As mentioned in the PR, we forget to call gfc_free_enum_history, which then
references initializers that were freed by reject_statement.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk/4.4?
2010-02-11 Jakub Jelinek <jakub@redhat.com>
PR fortran/43029
* decl.c (enumerator_decl): Don't call gfc_free_enum_history
here.
(gfc_match_enumerator_def): But here whenever enumerator_decl returns
MATCH_ERROR.
--- gcc/fortran/decl.c.jj 2010-02-11 10:49:20.000000000 +0100
+++ gcc/fortran/decl.c 2010-02-11 11:07:58.000000000 +0100
@@ -7124,10 +7124,9 @@ enumerator_decl (void)
if (initializer == NULL || initializer->ts.type != BT_INTEGER)
{
- gfc_error("ENUMERATOR %L not initialized with integer expression",
- &var_locus);
+ gfc_error ("ENUMERATOR %L not initialized with integer expression",
+ &var_locus);
m = MATCH_ERROR;
- gfc_free_enum_history ();
goto cleanup;
}
@@ -7193,7 +7192,10 @@ gfc_match_enumerator_def (void)
{
m = enumerator_decl ();
if (m == MATCH_ERROR)
- goto cleanup;
+ {
+ gfc_free_enum_history ();
+ goto cleanup;
+ }
if (m == MATCH_NO)
break;
Jakub