Patchwork [fortran,3/5] PR54730 ICE: confused by type-like fonctions: Fix restore_old_symbol

login
register
mail settings
Submitter Mikael Morin
Date Feb. 19, 2013, 4:48 p.m.
Message ID <20130219164827.30845.99554@marvin>
Download mbox | patch
Permalink /patch/221730/
State New
Headers show

Comments

Mikael Morin - Feb. 19, 2013, 4:48 p.m.
This is a fix for what looks like a thinko.
The other patches don't depend on it, so it can well wait for 4.9 if
that is preferred.
2013-02-15  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/54730
	* symbol.c (restore_old_symbol): Fix thinko.

Patch

diff --git a/symbol.c b/symbol.c
index 4f1752d..e4dbb41 100644
--- a/symbol.c
+++ b/symbol.c
@@ -2895,7 +2895,8 @@  restore_old_symbol (gfc_symbol *p)
 
   if (p->value != old->value)
     {
-      gfc_free_expr (old->value);
+      gcc_checking_assert (old->value == NULL);
+      gfc_free_expr (p->value);
       p->value = NULL;
     }