------- Comment #20 from mikael at gcc dot gnu dot org 2010-06-27 12:50 ------- (In reply to comment #17) > With the patch in comment #13 I get the following failures: > > > FAIL: gfortran.dg/entry_10.f90 -O0 (internal compiler error) > ... > FAIL: gfortran.dg/entry_13.f90 -O0 (internal compiler error) > ... > FAIL: gfortran.dg/entry_16.f90 -O0 (internal compiler error) Fixed.
For info the relevant hunk is : diff --git a/decl.c b/decl.c index aa7a266..d062433 100644 --- a/decl.c +++ b/decl.c @@ -840,10 +850,10 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) can be applied. */ (*result)->ns = gfc_current_ns; - gfc_find_sym_tree (name, gfc_current_ns, 0, &st); - st->n.sym = *result; st = gfc_get_unique_symtree (gfc_current_ns); - st->n.sym = sym; + gfc_assign_symbol (&st->n.sym, sym); + gfc_find_sym_tree (name, gfc_current_ns, 0, &st); + gfc_assign_symbol (&st->n.sym, *result); } } else i.e. the two symbol assignments are exchanged so that the symbol is not deleted between them. > > I have also a dozen ICEs in my favorite can of worms, for instance with > > > module grid_module > implicit none > type grid > end type > type field > type(grid) :: mesh > end type > contains > real function return_x(this) > class(grid) :: this > end function > end module > > module field_module > use grid_module, only: field,return_x > implicit none > contains > subroutine output(this) > class(field) :: this > print *,return_x(this%mesh) > end subroutine > end module > > There was a missing "end" statement to make it fail. Fixed, for info the relevant part is the change in gfc_find_symbol_vtab, espcially this hunk: diff --git a/class.c b/class.c index 37b9cf0..11af809 100644 --- a/class.c +++ b/class.c @@ -641,7 +730,17 @@ gfc_find_derived_vtab (gfc_symbol *derived, bool resolved) add_generics_to_declared_vtab (derived, vtab->ts.u.derived, derived, resolved); - return vtab; + found_sym = vtab; + +cleanup: + /* It is unexpected to have some symbols added at resolution or code + generation time. We commit the changes in order to keep a clean state. */ + if (found_sym) + gfc_commit_symbols (); + else + gfc_undo_symbols (); + + return found_sym; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43829