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 two spec issues


This patch fixes two issues with SPECint.  The input_real fix is because
we'd occasionally the string table entry for the real we were supposed
to read would contain something like:

  0x0.cp+33
          ^

The indicated 3 did not belong to the hexadecimal float, but
real_from_string didn't know that and would happily read until it found
a non-decimal character.  So we would occasionally read in numbers with
much larger exponents, with predictably bad results.

The input_expr_operand fix handles a case in 176.gcc:dwarfout.c where we
were faced with a construct like:

  output_die (CONDITION ? output_one_way : output_differently, ...)

And OUTPUT_ONE_WAY and OUTPUT_DIFFERENTLY were never explicitly called
from anywhere else.  cgraph would notice this and decide that the
functions weren't actually needed, leading to assembler errors.

Committed to the LTO branch.

-Nathan

2007-12-21  Nathan Froyd  <froydnj@codesourcery.com>

	* lto-read.c (input_real): Use a separate null-terminated buffer
	for calling real_from_string.
	(input_expr_operand): If we take the address of a FUNCTION_DECL,
	tell cgraph that it's needed.

Index: lto/lto-read.c
===================================================================
--- lto/lto-read.c	(revision 131119)
+++ lto/lto-read.c	(working copy)
@@ -266,11 +266,16 @@ input_real (struct input_block *ib, stru
   unsigned int len;
   const char * str;
   REAL_VALUE_TYPE value;
+  static char buffer[1000];
 
   LTO_DEBUG_TOKEN ("real");
   loc = input_uleb128 (ib);
   str = input_string_internal (data_in, loc, &len);
-  real_from_string (&value, str);
+  /* Copy over to make sure real_from_string doesn't see peculiar
+     trailing characters in the exponent.  */
+  memcpy (buffer, str, len);
+  buffer[len] = '\0';
+  real_from_string (&value, buffer);
   return build_real (type, value);
 }
 
@@ -1164,6 +1169,8 @@ input_expr_operand (struct input_block *
 
       if (TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == PARM_DECL)
 	TREE_ADDRESSABLE (x) = 1;
+      else if (TREE_CODE (x) == FUNCTION_DECL)
+	cgraph_mark_needed_node (cgraph_node (x));
 
       recompute_tree_invariant_for_addr_expr (result);
     }


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