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]

[PATCH] Fix LTO ICE in gfortran testsuite


This fixes an ICE that happens because C and Fortran do not
agree about DECL_OFFSET_ALIGN on fields of otherwise structurally
equivalent structs.  We already deal with this during type
merging, so simply re-use the function we have for this.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Now why do we have DECL_OFFSET_ALIGN again?

Richard.

2009-12-15  Richard Guenther  <rguenther@suse.de>

	* gimple.h (compare_field_offset): Declare.
	* gimple.c (compare_field_offset): Export.
	* lto-streamer-in.c (input_gimple_stmt): Use compare_field_offset.

Index: gcc/lto-streamer-in.c
===================================================================
*** gcc/lto-streamer-in.c	(revision 155210)
--- gcc/lto-streamer-in.c	(working copy)
*************** input_gimple_stmt (struct lto_input_bloc
*** 1082,1093 ****
  		    {
  		      if (tem == field
  			  || (TREE_TYPE (tem) == TREE_TYPE (field)
! 			      && (DECL_FIELD_OFFSET (tem)
! 				  == DECL_FIELD_OFFSET (field))
! 			      && (DECL_FIELD_BIT_OFFSET (tem)
! 				  == DECL_FIELD_BIT_OFFSET (field))
! 			      && (DECL_OFFSET_ALIGN (tem)
! 				  == DECL_OFFSET_ALIGN (field))))
  			break;
  		    }
  		  /* In case of type mismatches across units we can fail
--- 1082,1088 ----
  		    {
  		      if (tem == field
  			  || (TREE_TYPE (tem) == TREE_TYPE (field)
! 			      && compare_field_offset (tem, field)))
  			break;
  		    }
  		  /* In case of type mismatches across units we can fail
Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c	(revision 155210)
--- gcc/gimple.c	(working copy)
*************** compare_type_names_p (tree t1, tree t2, 
*** 3171,3177 ****
  
  /* Return true if the field decls F1 and F2 are at the same offset.  */
  
! static bool
  compare_field_offset (tree f1, tree f2)
  {
    if (DECL_OFFSET_ALIGN (f1) == DECL_OFFSET_ALIGN (f2))
--- 3171,3177 ----
  
  /* Return true if the field decls F1 and F2 are at the same offset.  */
  
! bool
  compare_field_offset (tree f1, tree f2)
  {
    if (DECL_OFFSET_ALIGN (f1) == DECL_OFFSET_ALIGN (f2))
Index: gcc/gimple.h
===================================================================
*** gcc/gimple.h	(revision 155210)
--- gcc/gimple.h	(working copy)
*************** extern bool is_gimple_call_addr (tree);
*** 921,926 ****
--- 921,927 ----
  extern tree get_call_expr_in (tree t);
  
  extern void recalculate_side_effects (tree);
+ extern bool compare_field_offset (tree, tree);
  extern tree gimple_register_type (tree);
  extern void print_gimple_types_stats (void);
  extern void free_gimple_type_tables (void);


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