]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/56674 (ICE in check_sym_interfaces)
authorMikael Morin <mikael@gcc.gnu.org>
Tue, 14 Apr 2015 09:18:15 +0000 (09:18 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Tue, 14 Apr 2015 09:18:15 +0000 (09:18 +0000)
PR fortran/56674
PR fortran/58813
PR fortran/59016
PR fortran/59024
fortran/
* symbol.c (save_symbol_data, gfc_save_symbol_data): Rename the
former to the latter and make it non-static.  Update callers.
* gfortran.h (gfc_save_symbol_data): New prototype.
* decl.c (gfc_match_decl_type_spec): Call 'gfc_save_symbol_data'
before modifying symbols 'sym' and 'dt_sym'.
testsuite/
* gfortran.dg/used_types_27.f90: New.

From-SVN: r222078

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/fortran/gfortran.h
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/used_types_27.f90 [new file with mode: 0644]

index ecd62bcbeaa801dcba7348905f1f97dc0fea3e99..589f2206d5231e5def2b7f0f29ee1dd91438b59b 100644 (file)
@@ -1,3 +1,15 @@
+2015-04-14  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/56674
+       PR fortran/58813
+       PR fortran/59016
+       PR fortran/59024
+       * symbol.c (save_symbol_data, gfc_save_symbol_data): Rename the
+       former to the latter and make it non-static.  Update callers.
+       * gfortran.h (gfc_save_symbol_data): New prototype.
+       * decl.c (gfc_match_decl_type_spec): Call 'gfc_save_symbol_data'
+       before modifying symbols 'sym' and 'dt_sym'.
+
 2015-03-23  Andre Vehreschild  <vehre@gmx.de>
            Janus Weil  <janus@gcc.gnu.org>
 
index eebecd59f1bb731a762bd345ca28c2fc4f04e744..ea1b20e84f489170c1bcaf49aca51edc338be020 100644 (file)
@@ -2851,6 +2851,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
       return MATCH_ERROR;
     }
 
+  gfc_save_symbol_data (sym);
   gfc_set_sym_referenced (sym);
   if (!sym->attr.generic
       && !gfc_add_generic (&sym->attr, sym->name, NULL))
@@ -2875,6 +2876,8 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
       sym->generic = intr;
       sym->attr.if_source = IFSRC_DECL;
     }
+  else
+    gfc_save_symbol_data (dt_sym);
 
   gfc_set_sym_referenced (dt_sym);
 
index 8cc20603928ac6a12c0950100f9388d7e9210bf9..11d3996c90eca064873f719a48f7f572341e928c 100644 (file)
@@ -2815,6 +2815,7 @@ bool verify_bind_c_derived_type (gfc_symbol *);
 bool verify_com_block_vars_c_interop (gfc_common_head *);
 gfc_symtree *generate_isocbinding_symbol (const char *, iso_c_binding_symbol,
                                          const char *, gfc_symtree *, bool);
+void gfc_save_symbol_data (gfc_symbol *);
 int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool);
 int gfc_get_ha_symbol (const char *, gfc_symbol **);
 int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
index 8edd6931f97caf5da33d9fee6ad5fad7c587ec73..dca3220fd3b848f1c6b255b05fec6c9ea6152b64 100644 (file)
@@ -2747,8 +2747,8 @@ single_undo_checkpoint_p (void)
 
 /* Save symbol with the information necessary to back it out.  */
 
-static void
-save_symbol_data (gfc_symbol *sym)
+void
+gfc_save_symbol_data (gfc_symbol *sym)
 {
   gfc_symbol *s;
   unsigned i;
@@ -2849,7 +2849,7 @@ gfc_get_sym_tree (const char *name, gfc_namespace *ns, gfc_symtree **result,
       p->mark = 1;
 
       /* Copy in case this symbol is changed.  */
-      save_symbol_data (p);
+      gfc_save_symbol_data (p);
     }
 
   *result = st;
@@ -2888,7 +2888,7 @@ gfc_get_ha_sym_tree (const char *name, gfc_symtree **result)
 
   if (st != NULL)
     {
-      save_symbol_data (st->n.sym);
+      gfc_save_symbol_data (st->n.sym);
       *result = st;
       return i;
     }
index a9c543298b0408440c3ea7d95ee44514a33adc1b..8b9d88bc390648656cad384caf274d316614e79d 100644 (file)
@@ -1,3 +1,11 @@
+2015-04-14  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/56674
+       PR fortran/58813
+       PR fortran/59016
+       PR fortran/59024
+       * gfortran.dg/used_types_27.f90: New.
+
 2015-04-07  Bin Cheng  <bin.cheng@arm.com>
 
        Backport from trunk r221889
diff --git a/gcc/testsuite/gfortran.dg/used_types_27.f90 b/gcc/testsuite/gfortran.dg/used_types_27.f90
new file mode 100644 (file)
index 0000000..4797f85
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/56674
+! PR fortran/58813
+! PR fortran/59016
+! PR fortran/59024
+! The generic name 'atomic_kind_types' was keeping pointers to freed
+! symbols, leading to random error-recovery ICEs.
+!
+! Original test case from Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>.
+
+MODULE atomic_kind_types
+  PUBLIC :: atomic_kind_type
+CONTAINS
+  INTEGER FUNCTION is_hydrogen(atomic_kind)
+    TYPE(atomic_kind_type), pointer :: atomic_kind ! { dg-error "used before it is defined" }
+  END FUNCTION
+END MODULE