Patchwork [fortran,2/22] Various minor fixups

login
register
mail settings
Submitter Mikael Morin
Date Oct. 5, 2010, 10:11 a.m.
Message ID <20101005100947.1836.81507@gimli.local>
Download mbox | patch
Permalink /patch/66790/
State New
Headers show

Comments

Mikael Morin - Oct. 5, 2010, 10:11 a.m.
2010-10-04  Mikael Morin  <mikael@gcc.gnu.org>

	* decl.c (match_procedure_in_type): Assertify if conditions.

Patch

diff --git a/decl.c b/decl.c
index 5b4ab18..3b01d39 100644
--- a/decl.c
+++ b/decl.c
@@ -7916,8 +7916,9 @@  match_procedure_in_type (void)
 	 would be an error.  If a GENERIC already targetted this binding, it may
 	 be already there but then typebound is still NULL.  */
       stree = gfc_find_symtree (ns->tb_sym_root, name);
-      if (stree && stree->n.tb)
+      if (stree)
 	{
+	  gcc_assert (stree->n.tb);
 	  gfc_error ("There is already a procedure with binding name '%s' for "
 		     "the derived type '%s' at %C", name, block->name);
 	  return MATCH_ERROR;
@@ -7925,11 +7926,9 @@  match_procedure_in_type (void)
 
       /* Insert it and set attributes.  */
 
-      if (!stree)
-	{
-	  stree = gfc_new_symtree (&ns->tb_sym_root, name);
-	  gcc_assert (stree);
-	}
+      gcc_assert (!stree);
+      stree = gfc_new_symtree (&ns->tb_sym_root, name);
+      gcc_assert (stree);
       stree->n.tb = gfc_get_typebound_proc (&tb);
 
       if (gfc_get_sym_tree (target, gfc_current_ns, &stree->n.tb->u.specific,