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]

[lto] Fix streaming of COMPONENT_REF/ARRAY_REF


This patch fixes 2 regressions.  The streamer was not writing all
operands of COMPONENT_REF and ARRAY_REF.

Tested on x86_64.


Diego.

	* lto-function-out.c (output_expr_operand): Handle
	NULL_TREE values for EXPR.
	<case COMPONENT_REF>: Write operand 2.
	<case ARRAY_REF>: Write operands 2 and 3.
	* lto-function-in.c (input_expr_operand): Corresponding
	changes.

Index: lto-function-out.c
===================================================================
--- lto-function-out.c	(revision 148016)
+++ lto-function-out.c	(working copy)
@@ -1054,7 +1054,11 @@ output_expr_operand (struct output_block
   enum tree_code_class klass;
   unsigned int tag;
 
-  gcc_assert (expr);
+  if (expr == NULL_TREE)
+    {
+      output_zero (ob);
+      return;
+    }
 
   code = TREE_CODE (expr);
   klass = TREE_CODE_CLASS (code);
@@ -1234,7 +1238,7 @@ output_expr_operand (struct output_block
       output_record_start (ob, expr, expr, tag);
       output_expr_operand (ob, TREE_OPERAND (expr, 0));
       output_expr_operand (ob, TREE_OPERAND (expr, 1));
-      /* Ignore 3 because it can be recomputed.  */
+      output_expr_operand (ob, TREE_OPERAND (expr, 2));
       break;
 
     case BIT_FIELD_REF:
@@ -1263,11 +1267,11 @@ output_expr_operand (struct output_block
 
     case ARRAY_REF:
     case ARRAY_RANGE_REF:
-      /* Ignore operands 2 and 3 for ARRAY_REF and ARRAY_RANGE REF
-	 because they can be recomputed.  */
       output_record_start (ob, expr, expr, tag);
       output_expr_operand (ob, TREE_OPERAND (expr, 0));
       output_expr_operand (ob, TREE_OPERAND (expr, 1));
+      output_expr_operand (ob, TREE_OPERAND (expr, 2));
+      output_expr_operand (ob, TREE_OPERAND (expr, 3));
       break;
 
 
Index: lto-function-in.c
===================================================================
--- lto-function-in.c	(revision 148016)
+++ lto-function-in.c	(working copy)
@@ -528,6 +528,9 @@ input_expr_operand (struct lto_input_blo
   tree result = NULL_TREE;
   bool needs_line_set;
 
+  if (tag == LTO_null)
+    return NULL_TREE;
+
   if (tag == LTO_type_ref)
     {
       int index = lto_input_uleb128 (ib);
@@ -781,13 +784,11 @@ input_expr_operand (struct lto_input_blo
 
     case COMPONENT_REF:
       {
-	tree op0;
-	tree op1;
+	tree op0, op1, op2;
 	op0 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
 	op1 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
-  
-	/* Ignore 3 because it can be recomputed.  */
-	result = build3 (code, type, op0, op1, NULL_TREE);
+	op2 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
+	result = build3 (code, type, op0, op1, op2);
       }
       break;
 
@@ -814,13 +815,13 @@ input_expr_operand (struct lto_input_blo
     case ARRAY_REF:
     case ARRAY_RANGE_REF:
       {
-	/* Ignore operands 2 and 3 for ARRAY_REF and ARRAY_RANGE REF
-	   because they can be recomputed.  */
-	tree op0, op1;
+	tree op0, op1, op2, op3;
 	
 	op0 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
 	op1 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
-	result = build4 (code, type, op0, op1, NULL_TREE, NULL_TREE);
+	op2 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
+	op3 = input_expr_operand (ib, data_in, fn, input_record_start (ib));
+	result = build4 (code, type, op0, op1, op2, op3);
       }
       break;
 


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