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


The code sourcery side has fixed enough bugs so that it looks like most
of the failures were now mine.

Here is a partial fix of my bugs so that the codesourcery side can
continue in parallel.

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

    * lto-function-out.c (struct string_slot): Added len.
    (eq_string_slot_node): Fixed to honor real length of strings with
nulls. 
    (output_string): Set len and fix debugging.
    (output_expr_operand): Output CASE_HIGH and CASE_LOW properly.


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

    * lto-read.c (input_real): Output debugging in proper order.
    (input_integer): Compute bit lengths properly.
    (input_list): Clean up declaration.
    (input_expr_operand): Change calls to input_real to match fix.
    Make reading of LTO_bit_field_ref1 match output.
    (input_local_var): Make reading of attributes match what is being
    written.
    (dump_debug_stream): Also print char in hex.
    (debug_out_fun): Fix signed unsigned mismatch.


The bugs were

1) improper hashing of the character strings.
2) improper encoding of very long integers (there is still one more rare
bug here, it will get fixed this afternoon.)
3) Various mismatches between the forms being written and the form expected.

Most of the failures now are some oddball bug with initializing the cfg
and i need a little help from danny on this plus about 4 other rarer
errors. 

However there are still codesourcery failures in prefix, driver-i386,
c-incpath, pretty-print.  There are other codesourcery failures, but
most are likely duplicates of these. 

committed as revision 129380

kenny

Index: lto-function-out.c
===================================================================
--- lto-function-out.c	(revision 129371)
+++ lto-function-out.c	(working copy)
@@ -151,6 +151,7 @@ eq_label_slot_node (const void *p1, cons
 
 struct string_slot {
   const char *s;
+  int len;
   unsigned int slot_num;
 };
 
@@ -175,7 +176,15 @@ eq_string_slot_node (const void *p1, con
   const struct string_slot *ds2 =
     (const struct string_slot *) p2;
 
-  return strcmp (ds1->s, ds2->s);
+  if (ds1->len == ds2->len)
+    {
+      int i;
+      for (i=0; i<ds1->len; i++)
+	if (ds1->s[i] != ds2->s[i])
+	  return 0;
+      return 1;
+    }
+  else return 0;
 }
 
 
@@ -583,6 +592,7 @@ output_string (struct output_block *ob, 
   void **slot;
   struct string_slot s_slot;
   s_slot.s = string;
+  s_slot.len = len;
 
   slot = htab_find_slot (ob->string_hash_table, &s_slot, INSERT);
   if (*slot == NULL)
@@ -600,7 +610,6 @@ output_string (struct output_block *ob, 
       output_uleb128_stream (string_stream, len);
       for (i=0; i<len; i++)
 	output_1_stream (string_stream, string[i]);
-
     }
   else
     {
@@ -612,7 +621,7 @@ output_string (struct output_block *ob, 
 	 occurence of this string or not.  Thus, we simulate the same
 	 debugging info as would be output as if this was a new
 	 string.  */
-      LTO_DEBUG_WIDE ("U", old_slot->slot_num);
+      LTO_DEBUG_WIDE ("U", len);
     }
   LTO_DEBUG_STRING (string, len);
 }
@@ -1233,10 +1242,10 @@ output_expr_operand (struct output_block
 			     LTO_case_label_expr0 + variant);
 
 	if (CASE_LOW (expr) != NULL_TREE)
-	  output_integer (ob, CASE_LOW (expr));
+	  output_expr_operand (ob, CASE_LOW (expr));
 	if (CASE_HIGH (expr) != NULL_TREE)
-	  output_integer (ob, CASE_HIGH (expr));
-	output_expr_operand (ob, CASE_LABEL (expr));
+	  output_expr_operand (ob, CASE_HIGH (expr));
+	output_label_ref (ob, CASE_LABEL (expr));
       }
       break;
 
Index: lto/lto-read.c
===================================================================
--- lto/lto-read.c	(revision 129371)
+++ lto/lto-read.c	(working copy)
@@ -193,14 +193,16 @@ input_string (struct data_in *data_in, u
 /* Input a real constant of TYPE at LOC.  */
 
 static tree
-input_real (struct data_in *data_in, unsigned int loc, tree type)
+input_real (struct input_block *ib, struct data_in *data_in, tree type)
 {
+  unsigned int loc;
   unsigned int len;
-  const char * str = input_string_internal (data_in, loc, &len); 
+  const char * str;
   REAL_VALUE_TYPE value;
 
   LTO_DEBUG_TOKEN ("real");
-
+  loc = input_uleb128 (ib);
+  str = input_string_internal (data_in, loc, &len);
   real_from_string (&value, str);
   return build_real (type, value);
 }
@@ -214,22 +216,22 @@ input_integer (struct input_block *ib, t
   HOST_WIDE_INT low = 0;
   HOST_WIDE_INT high = 0;
   int shift = 0;
-  unsigned int byte;
+  HOST_WIDE_INT byte;
 
   while (true)
     {
       byte = input_1_unsigned (ib);
-      if (shift < HOST_BITS_PER_INT - 7)
+      if (shift < HOST_BITS_PER_WIDE_INT - 7)
 	/* Working on the low part.  */
 	low |= (byte & 0x7f) << shift;
-      else if (shift >= HOST_BITS_PER_INT)
+      else if (shift >= HOST_BITS_PER_WIDE_INT)
 	/* Working on the high part.  */
-	high |= (byte & 0x7f) << (shift - HOST_BITS_PER_INT);
+	high |= (byte & 0x7f) << (shift - HOST_BITS_PER_WIDE_INT);
       else
 	{
 	  /* Working on the transition between the low and high parts.  */
 	  low |= (byte & 0x7f) << shift;
-	  high |= (byte & 0x7f) >> (HOST_BITS_PER_INT - shift);
+	  high |= (byte & 0x7f) >> (HOST_BITS_PER_WIDE_INT - shift);
 	}
 
       shift += 7;
@@ -238,12 +240,12 @@ input_integer (struct input_block *ib, t
 	  if (byte & 0x40)
 	    {
 	      /* The number is negative.  */
-	      if (shift < HOST_BITS_PER_INT)
+	      if (shift < HOST_BITS_PER_WIDE_INT)
 		{
 		  low |= - (1 << shift);
 		  high = -1;
 		}
-	      else if (shift < (2 * HOST_BITS_PER_INT))
+	      else if (shift < (2 * HOST_BITS_PER_WIDE_INT))
 		high |= - (1 << shift);
 	    }
 
@@ -287,8 +289,10 @@ input_list (struct input_block *ib, stru
   tree first = NULL_TREE;
   if (tag)
     {
+      tree next;
+
       first = build_tree_list (NULL_TREE, input_expr_operand (ib, data_in, fn, tag));
-      tree next = first;
+      next = first;
       tag = input_record_start (ib);
       while (tag)
 	{
@@ -452,9 +456,9 @@ input_expr_operand (struct input_block *
       if (tag == LTO_complex_cst1)
 	{
 	  TREE_REALPART (result) 
-	    = input_real (data_in, input_uleb128 (ib), type);
+	    = input_real (ib, data_in, type);
 	  TREE_IMAGPART (result) 
-	    = input_real (data_in, input_uleb128 (ib), type);
+	    = input_real (ib, data_in, type);
 	}
       else
 	{
@@ -468,7 +472,7 @@ input_expr_operand (struct input_block *
       break;
 
     case REAL_CST:
-      result = input_real (data_in, input_uleb128 (ib), type);
+      result = input_real (ib, data_in, type);
       break;
 
     case STRING_CST:
@@ -485,18 +489,12 @@ input_expr_operand (struct input_block *
 	  {
 	    int i;
 	    tree last 
-	      = build_tree_list (NULL_TREE, 
-				 input_real (data_in, 
-					     input_uleb128 (ib), 
-					     type));
+	      = build_tree_list (NULL_TREE, input_real (ib, data_in, type));
 	    chain = last; 
 	    for (i = 1; i < len; i++)
 	      {
 		tree t 
-		  = build_tree_list (NULL_TREE, 
-				     input_real (data_in, 
-						 input_uleb128 (ib), 
-						 type));
+		  = build_tree_list (NULL_TREE, input_real (ib, data_in, type));
 		TREE_CHAIN (last) = t;
 		last = t;
 	      }
@@ -720,8 +718,8 @@ input_expr_operand (struct input_block *
 	tree op2;
 	if (tag == LTO_bit_field_ref1)
 	  {
-	    op1 = input_integer (ib, SIZETYPE);
-	    op2 = input_integer (ib, SIZETYPE);
+	    op1 = build_int_cst_wide (sizetype, input_uleb128 (ib), 0);
+	    op2 = build_int_cst_wide (sizetype, input_uleb128 (ib), 0);
 	    op0 = input_expr_operand (ib, data_in, fn,
 				      input_record_start (ib));
 	  }
@@ -1067,8 +1065,7 @@ input_local_var (struct data_in *data_in
   if (variant & 0x1)
     {
       LTO_DEBUG_TOKEN ("attributes");
-      DECL_ATTRIBUTES (result) 
-	= input_expr_operand (ib, data_in, fn, input_record_start (ib));
+      DECL_ATTRIBUTES (result) = input_list (ib, data_in, fn);
     }
   if (variant & 0x2)
     DECL_SIZE_UNIT (result) 
@@ -1688,8 +1685,8 @@ dump_debug_stream (struct input_block *s
   int chars = 0;
   int hit_pos = -1;
   fprintf (stderr, 
-	   "stream failure: looking for a '%c' in the debug stream.\nHowever the data translated into a '%c' at position%d\n\n",
-	   c, b, stream->p);
+	   "stream failure: looking for a '%c'[0x%x] in the debug stream.\nHowever the data translated into a '%c'[0x%x]at position%d\n\n",
+	   c, c, b, b, stream->p);
   
   while (i < stream->len)
     {
@@ -1746,7 +1743,7 @@ static void
 debug_out_fun (struct lto_debug_context *context, char c)
 {
   struct input_block *stream = (struct input_block *)context->current_data;
-  unsigned char b = input_1_unsigned (stream);
+  char b = input_1_unsigned (stream);
 
   if (b != c)
     {

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