Patchwork [fortran] PR44662 - unitialized memory with typebound procedures

login
register
mail settings
Submitter Mikael Morin
Date July 2, 2010, 5:15 p.m.
Message ID <4C2E1EA8.802@sfr.fr>
Download mbox | patch
Permalink /patch/57699/
State New
Headers show

Comments

Mikael Morin - July 2, 2010, 5:15 p.m.
Hello,

this could probably go in as obvious, but as I haven't committed 
anything since ... well, last time, I would like a "OK to mess around 
again".

Currently regression testing. OK for trunk if it passes ?

Mikael
2010-07-02  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/44662
	* decl.c (match_procedure_in_type): Clear structure before using.
	(gfc_match_generic): Ditto.
Steve Kargl - July 2, 2010, 6:12 p.m.
On Fri, Jul 02, 2010 at 07:15:20PM +0200, Mikael Morin wrote:
> Hello,
> 
> this could probably go in as obvious, but as I haven't committed 
> anything since ... well, last time, I would like a "OK to mess around 
> again".
> 
> Currently regression testing. OK for trunk if it passes ?
> 

It does appear to be obvious.

OK.

Patch

diff --git a/decl.c b/decl.c
index 07c3acb..e5ef139 100644
--- a/decl.c
+++ b/decl.c
@@ -7697,8 +7697,8 @@  match_procedure_in_type (void)
     }
 
   /* Construct the data structure.  */
+  memset (&tb, 0, sizeof (tb));
   tb.where = gfc_current_locus;
-  tb.is_generic = 0;
 
   /* Match binding attributes.  */
   m = match_binding_attributes (&tb, false, false);
@@ -7856,6 +7856,9 @@  gfc_match_generic (void)
   ns = block->f2k_derived;
   gcc_assert (block && ns);
 
+  memset (&tbattr, 0, sizeof (tbattr));
+  tbattr.where = gfc_current_locus;
+
   /* See if we get an access-specifier.  */
   m = match_binding_attributes (&tbattr, true, false);
   if (m == MATCH_ERROR)