This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR59723: fix LTO + fortran namelist ICEs


On Tue, 4 Feb 2014, Dominique Dhumieres wrote:

> Richard,
> 
> With your patch at http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00144.html
> I get multiple ICEs when testing with
> check-gfortran RUNTESTFLAGS="--target_board=unix'{-m32/-flto,-m64/-flto}'"
> 
> They are of the kind
> 
> lto1: internal compiler error: in mentions_vars_p, at lto/lto.c:972
> 
> Note that the Aldy's patch at http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01384.html
> fixed all the ICE in the same tests.

Yep, I'm collecting more fixes - see below for what I have.  Aldy's
fix is simply wrong (as is the namelist-decl-ref handling in the LTO 
code).

With the patch below we can still hit an ICE in lto_fixup_prevailing_decls
as we seem to arrive with a CONSTRUCTOR here.  I'm waiting for Micha
to show up to tell me if that's simply because CONSTRUCTOR isn't handled
in the code (yet) or if there is a deeper reason.

Richard.

2014-02-04  Richard Biener  <rguenther@suse.de>

	PR lto/59723
	* lto-streamer-out.c (lto_output_tree_ref): Do not write
	trees from lto_output_tree_ref.
	* lto-streamer-in.c (lto_input_tree_ref): Handle LTO_namelist_decl_ref
	similar to LTO_imported_decl_ref.

	lto/
	* lto.c (mentions_vars_p) Handle NAMELIST_DECL.

Index: gcc/lto-streamer-out.c
===================================================================
*** gcc/lto-streamer-out.c	(revision 207455)
--- gcc/lto-streamer-out.c	(working copy)
*************** lto_output_tree_ref (struct output_block
*** 255,273 ****
        break;
  
      case NAMELIST_DECL:
!       {
! 	unsigned i;
! 	tree value, tmp;
! 
! 	streamer_write_record_start (ob, LTO_namelist_decl_ref);
! 	stream_write_tree (ob, DECL_NAME (expr), true);
! 	tmp = NAMELIST_DECL_ASSOCIATED_DECL (expr);
! 	gcc_assert (tmp != NULL_TREE);
! 	streamer_write_uhwi (ob, CONSTRUCTOR_ELTS (tmp)->length());
! 	FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (tmp), i, value)
! 	  lto_output_var_decl_index (ob->decl_state, ob->main_stream, value);
! 	break;
!       }
  
      case NAMESPACE_DECL:
        streamer_write_record_start (ob, LTO_namespace_decl_ref);
--- 261,269 ----
        break;
  
      case NAMELIST_DECL:
!       streamer_write_record_start (ob, LTO_namelist_decl_ref);
!       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
!       break;
  
      case NAMESPACE_DECL:
        streamer_write_record_start (ob, LTO_namespace_decl_ref);

Index: gcc/lto/lto.c
===================================================================
*** gcc/lto/lto.c	(revision 207455)
--- gcc/lto/lto.c	(working copy)
*************** mentions_vars_p (tree t)
*** 926,931 ****
--- 926,932 ----
      case RESULT_DECL:
      case IMPORTED_DECL:
      case NAMESPACE_DECL:
+     case NAMELIST_DECL:
        return mentions_vars_p_decl_common (t);
  
      case VAR_DECL:
Index: gcc/lto-streamer-in.c
===================================================================
*** gcc/lto-streamer-in.c	(revision 207455)
--- gcc/lto-streamer-in.c	(working copy)
*************** lto_input_tree_ref (struct lto_input_blo
*** 244,275 ****
      case LTO_imported_decl_ref:
      case LTO_label_decl_ref:
      case LTO_translation_unit_decl_ref:
        ix_u = streamer_read_uhwi (ib);
        result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
        break;
  
-     case LTO_namelist_decl_ref:
-       {
- 	tree tmp;
- 	vec<constructor_elt, va_gc> *nml_decls = NULL;
- 	unsigned i, n;
- 
- 	result = make_node (NAMELIST_DECL);
- 	TREE_TYPE (result) = void_type_node;
- 	DECL_NAME (result) = stream_read_tree (ib, data_in);
- 	n = streamer_read_uhwi (ib);
- 	for (i = 0; i < n; i++)
- 	  {
- 	    ix_u = streamer_read_uhwi (ib);
- 	    tmp = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
- 	    gcc_assert (tmp != NULL_TREE);
- 	    CONSTRUCTOR_APPEND_ELT (nml_decls, NULL_TREE, tmp);
- 	  }
- 	NAMELIST_DECL_ASSOCIATED_DECL (result) = build_constructor (NULL_TREE,
- 								    nml_decls);
- 	break;
-       }
- 
      default:
        gcc_unreachable ();
      }
--- 244,254 ----
      case LTO_imported_decl_ref:
      case LTO_label_decl_ref:
      case LTO_translation_unit_decl_ref:
+     case LTO_namelist_decl_ref:
        ix_u = streamer_read_uhwi (ib);
        result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
        break;
  
      default:
        gcc_unreachable ();
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]