This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix --enable-checking=valgrind failure on enum_5.f90 (PR fortran/43029)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]