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]: patch committed to serialize COMPLEX_CST


The type for COMPLEX_CST was not being properly serialized.

2007-11-16  Kenneth Zadeck <zadeck@naturalbridge.com>

    * lto-function-out.c (output_expr_operand): Get types right
    for COMPLEX_CST.
2007-11-16  Kenneth Zadeck <zadeck@naturalbridge.com>

    * lto-read.c (input_expr_operand): Get types right
    for COMPLEX_CST.

This fixes 2 regressions, only 156 to go.

Committed as revision 130256.

kenny
Index: lto-function-out.c
===================================================================
--- lto-function-out.c	(revision 130238)
+++ lto-function-out.c	(working copy)
@@ -1261,15 +1261,15 @@ output_expr_operand (struct output_block
     case COMPLEX_CST:
       if (TREE_CODE (TREE_REALPART (expr)) == REAL_CST)
 	{
-	  output_record_start (ob, expr, TREE_REALPART (expr),
-			       LTO_complex_cst1);
+	  output_record_start (ob, expr, expr, LTO_complex_cst1);
+	  output_type_ref (ob, TREE_TYPE (TREE_REALPART (expr)));
 	  output_real (ob, TREE_REALPART (expr));
 	  output_real (ob, TREE_IMAGPART (expr));
 	}
       else
 	{
-	  output_record_start (ob, expr, TREE_REALPART (expr),
-			       LTO_complex_cst0);
+	  output_record_start (ob, expr, expr, LTO_complex_cst0);
+	  output_type_ref (ob, TREE_TYPE (TREE_REALPART (expr)));
 	  output_integer (ob, TREE_REALPART (expr));
 	  output_integer (ob, TREE_IMAGPART (expr));
 	}
Index: lto/lto-read.c
===================================================================
--- lto/lto-read.c	(revision 130239)
+++ lto/lto-read.c	(working copy)
@@ -610,19 +610,21 @@ input_expr_operand (struct input_block *
   switch (code)
     {
     case COMPLEX_CST:
-      result = build0 (code, type);
-      if (tag == LTO_complex_cst1)
-	{
-	  TREE_REALPART (result) 
-	    = input_real (ib, data_in, type);
-	  TREE_IMAGPART (result) 
-	    = input_real (ib, data_in, type);
-	}
-      else
-	{
-	  TREE_REALPART (result) = input_integer (ib, type);
-	  TREE_IMAGPART (result) = input_integer (ib, type);
-	}
+      {
+	tree elt_type = input_type_ref (data_in, ib);
+
+	result = build0 (code, type);
+	if (tag == LTO_complex_cst1)
+	  {
+	    TREE_REALPART (result) = input_real (ib, data_in, elt_type);
+	    TREE_IMAGPART (result) = input_real (ib, data_in, elt_type);
+	  }
+	else
+	  {
+	    TREE_REALPART (result) = input_integer (ib, elt_type);
+	    TREE_IMAGPART (result) = input_integer (ib, elt_type);
+	  }
+      }
       break;
 
     case INTEGER_CST:

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