Commit 44c57c2f by Mikael Morin

re PR fortran/56674 (ICE in check_sym_interfaces)

	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: r221972
parent c3d71b62
2015-04-10 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'.
2013-04-09 Paul Thomas <pault@gcc.gnu.org> 2013-04-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/56852 PR fortran/56852
......
...@@ -2876,6 +2876,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) ...@@ -2876,6 +2876,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
return MATCH_ERROR; return MATCH_ERROR;
} }
gfc_save_symbol_data (sym);
gfc_set_sym_referenced (sym); gfc_set_sym_referenced (sym);
if (!sym->attr.generic if (!sym->attr.generic
&& !gfc_add_generic (&sym->attr, sym->name, NULL)) && !gfc_add_generic (&sym->attr, sym->name, NULL))
...@@ -2900,6 +2901,8 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) ...@@ -2900,6 +2901,8 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
sym->generic = intr; sym->generic = intr;
sym->attr.if_source = IFSRC_DECL; sym->attr.if_source = IFSRC_DECL;
} }
else
gfc_save_symbol_data (dt_sym);
gfc_set_sym_referenced (dt_sym); gfc_set_sym_referenced (dt_sym);
......
...@@ -2819,6 +2819,7 @@ bool verify_bind_c_derived_type (gfc_symbol *); ...@@ -2819,6 +2819,7 @@ bool verify_bind_c_derived_type (gfc_symbol *);
bool verify_com_block_vars_c_interop (gfc_common_head *); bool verify_com_block_vars_c_interop (gfc_common_head *);
gfc_symtree *generate_isocbinding_symbol (const char *, iso_c_binding_symbol, gfc_symtree *generate_isocbinding_symbol (const char *, iso_c_binding_symbol,
const char *, gfc_symtree *, bool); 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_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool);
int gfc_get_ha_symbol (const char *, gfc_symbol **); int gfc_get_ha_symbol (const char *, gfc_symbol **);
int gfc_get_ha_sym_tree (const char *, gfc_symtree **); int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
......
...@@ -2758,8 +2758,8 @@ single_undo_checkpoint_p (void) ...@@ -2758,8 +2758,8 @@ single_undo_checkpoint_p (void)
/* Save symbol with the information necessary to back it out. */ /* Save symbol with the information necessary to back it out. */
static void void
save_symbol_data (gfc_symbol *sym) gfc_save_symbol_data (gfc_symbol *sym)
{ {
gfc_symbol *s; gfc_symbol *s;
unsigned i; unsigned i;
...@@ -2860,7 +2860,7 @@ gfc_get_sym_tree (const char *name, gfc_namespace *ns, gfc_symtree **result, ...@@ -2860,7 +2860,7 @@ gfc_get_sym_tree (const char *name, gfc_namespace *ns, gfc_symtree **result,
p->mark = 1; p->mark = 1;
/* Copy in case this symbol is changed. */ /* Copy in case this symbol is changed. */
save_symbol_data (p); gfc_save_symbol_data (p);
} }
*result = st; *result = st;
...@@ -2899,7 +2899,7 @@ gfc_get_ha_sym_tree (const char *name, gfc_symtree **result) ...@@ -2899,7 +2899,7 @@ gfc_get_ha_sym_tree (const char *name, gfc_symtree **result)
if (st != NULL) if (st != NULL)
{ {
save_symbol_data (st->n.sym); gfc_save_symbol_data (st->n.sym);
*result = st; *result = st;
return i; return i;
} }
......
2015-04-10 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-09 Kirill Yukhin <kirill.yukhin@intel.com> 2015-04-09 Kirill Yukhin <kirill.yukhin@intel.com>
PR target/65671 PR target/65671
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment